You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<li><strong><codeclass="language-plaintext highlighter-rouge">{JSON}</code></strong>—An object with a <codeclass="language-plaintext highlighter-rouge">searchText</code> property containing the text to search for, and an optional <codeclass="language-plaintext highlighter-rouge">options</code> property for search configuration</li>
528
+
<li><strong><codeclass="language-plaintext highlighter-rouge">"string"</code></strong>—Alternatively, a plain string to search for</li>
529
+
<li><strong>Response: <codeclass="language-plaintext highlighter-rouge">[{JSON}]</code></strong>—An array of annotation objects matching the search, sorted by relevance score</li>
530
+
</ul>
531
+
<p>
532
+
The Text Search endpoint performs a full-text search across annotation text content in both IIIF Presentation API 3.0 and 2.1 resources. This endpoint searches for exact word matches (case-insensitive) and tokenizes the search text, finding documents that contain all the search terms anywhere in their text content.
533
+
</p>
534
+
<p>
535
+
The search covers multiple text fields depending on the IIIF version:
536
+
</p>
537
+
<ul>
538
+
<li><strong>IIIF 3.0 fields:</strong><codeclass="language-plaintext highlighter-rouge">body.value</code>, <codeclass="language-plaintext highlighter-rouge">bodyValue</code>, and nested structures in <codeclass="language-plaintext highlighter-rouge">items</code> and <codeclass="language-plaintext highlighter-rouge">annotations</code></li>
539
+
<li><strong>IIIF 2.1 fields:</strong><codeclass="language-plaintext highlighter-rouge">resource.chars</code>, <codeclass="language-plaintext highlighter-rouge">resource.cnt:chars</code>, and nested structures in AnnotationLists, Canvas <codeclass="language-plaintext highlighter-rouge">otherContent</code>, and Manifest sequences</li>
540
+
</ul>
541
+
<p>
542
+
Search behavior:
543
+
</p>
544
+
<ul>
545
+
<li>Searches are case-insensitive</li>
546
+
<li>Standard linguistic analysis is applied (stemming, stop words, etc.)</li>
547
+
<li>Multi-word searches find documents containing <strong>all</strong> the words (AND logic)</li>
548
+
<li>Partial word matches are NOT supported (use wildcards for that)</li>
549
+
<li>Results are sorted by relevance score (highest first)</li>
550
+
<li>A <codeclass="language-plaintext highlighter-rouge">__rerum.score</code> property is added to each result indicating match quality</li>
551
+
</ul>
552
+
<p>
553
+
The <codeclass="language-plaintext highlighter-rouge">limit</code> and <codeclass="language-plaintext highlighter-rouge">skip</code> URL parameters can be used for pagination. By default, <codeclass="language-plaintext highlighter-rouge">limit=100</code> and <codeclass="language-plaintext highlighter-rouge">skip=0</code>. It is recommended to use a limit of 100 or less for optimal performance.
554
+
</p>
555
+
<pclass="alert">
556
+
Note: This endpoint requires MongoDB Atlas Search indexes named "presi3AnnotationText" and "presi2AnnotationText" to be configured on the database.
557
+
</p>
558
+
<p>
559
+
<divclass="exHeading">Javascript Example (JSON Object)</div>
<li><strong><codeclass="language-plaintext highlighter-rouge">{JSON}</code></strong>—An object with a <codeclass="language-plaintext highlighter-rouge">searchText</code> property containing the phrase to search for, and an optional <codeclass="language-plaintext highlighter-rouge">options</code> property (default <code>slop: 2</code>)</li>
638
+
<li><strong><codeclass="language-plaintext highlighter-rouge">"string"</code></strong>—Alternatively, a plain string phrase to search for</li>
639
+
<li><strong>Response: <codeclass="language-plaintext highlighter-rouge">[{JSON}]</code></strong>—An array of annotation objects matching the phrase search, sorted by relevance score</li>
640
+
</ul>
641
+
<p>
642
+
The Phrase Search endpoint performs a proximity-based search for multi-word phrases, finding documents where search terms appear near each other in sequence. This is more precise than standard text search for multi-word queries while still being flexible enough to allow for minor variations.
643
+
</p>
644
+
<p>
645
+
The phrase search uses a "slop" value (default: 2) that allows up to 2 intervening words between search terms. This means the words don't need to be directly adjacent, providing flexibility while maintaining phrase coherence.
646
+
</p>
647
+
<p>
648
+
Like the standard text search, this endpoint searches across both IIIF Presentation API 3.0 and 2.1 resources, covering the same text fields.
649
+
</p>
650
+
<p>
651
+
Phrase matching examples with slop: 2:
652
+
</p>
653
+
<ul>
654
+
<li><code>"medieval manuscript"</code> matches:
655
+
<ul>
656
+
<li>✓ "medieval manuscript"</li>
657
+
<li>✓ "medieval illuminated manuscript"</li>
658
+
<li>✓ "manuscript from medieval times"</li>
659
+
<li>✗ "medieval art with many beautiful decorated manuscripts" (too many words between)</li>
660
+
</ul>
661
+
</li>
662
+
<li><code>"Bryan Haberberger"</code> matches:
663
+
<ul>
664
+
<li>✓ "Bryan Haberberger"</li>
665
+
<li>✓ "Bryan the Haberberger"</li>
666
+
<li>✓ "Bryan A. Haberberger"</li>
667
+
<li>✗ "Bryan loves to eat hamburgers with Haberberger" (too many words between)</li>
668
+
</ul>
669
+
</li>
670
+
</ul>
671
+
<p>
672
+
Use cases:
673
+
</p>
674
+
<ul>
675
+
<li>Finding exact or near-exact phrases</li>
676
+
<li>Searching for names or titles</li>
677
+
<li>Looking for specific multi-word concepts</li>
678
+
<li>When you need more precision than standard search but more flexibility than exact matching</li>
679
+
</ul>
680
+
<p>
681
+
The <codeclass="language-plaintext highlighter-rouge">limit</code> and <codeclass="language-plaintext highlighter-rouge">skip</code> URL parameters work the same as in the standard text search endpoint for pagination support.
<spanclass="ind2">"bodyValue": "This manuscript features illuminated letters",</span>
737
+
<spanclass="ind2">"__rerum":{</span>
738
+
<spanclass="ind3">...,</span>
739
+
<spanclass="ind3">"score": 4.781</span>
740
+
<spanclass="ind2">}</span>
741
+
<spanclass="ind1">},</span>
742
+
<spanclass="ind1">...</span>
743
+
<span>]</span>
744
+
</code></pre>
745
+
<pclass="alert">
746
+
Phrase search is generally faster than wildcard search and provides a good balance of precision and recall. Results are sorted by relevance with the <code>__rerum.score</code> property indicating match quality.
747
+
</p>
748
+
</p>
507
749
<h3id="http-post-method-override">HTTP POST Method Override</h3>
508
750
<pclass="alert"> This section is non-normative. </p>
0 commit comments