Difference between revisions of "Search with Xapian Guide"

From EPrints Documentation
Jump to: navigation, search
m
m (formatting improved)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
If your repository has Xapian search enabled for "Simple Search" (e.g. http://example.eprints.org/cgi/search/simple).  Then you can take advantage of some useful features to make more effective queries.  You should be able to tell whether you have Xapian search enabled by checking whether you have the option ''by relevance match'' in the list of ordering options.  This in itself can be useful, as it will rank results where the words you are searching for occur more frequently, which can be useful if the words are likely to match against a lot of items.
+
[[Category: Howto]]
 +
[[Category: Work in Progress]]
 +
 
 +
If your repository has Xapian search enabled for "Simple Search" (e.g. <nowiki>http://example.eprints.org/cgi/search/simple</nowiki>).  Then you can take advantage of some useful features to make more effective queries.  You should be able to tell whether you have Xapian search enabled by checking whether you have the option ''by relevance match'' in the list of ordering options.  This in itself can be useful, as it will rank results where the words you are searching for occur more frequently, which can be useful if the words are likely to match against a lot of items.
  
 
== Specific Phrases ==
 
== Specific Phrases ==
Line 6: Line 9:
  
 
== Some words but not others ==
 
== Some words but not others ==
If you prepend the words you want to find with a '''+''' and the words you do not want to find with a '''-''':
+
If you prepend the words you want to find with a <code>+</code> and the words you do not want to find with a <code>-</code>:
 
  +science -engineering +mathematics
 
  +science -engineering +mathematics
  
 
== This word near another word ==
 
== This word near another word ==
If you put the phrase NEAR between the two words then it will find matches where the words have 10 or less words in between:
+
If you put the phrase <code>NEAR</code> between the two words then it will find matches where the words have 10 or less words in between:
 
  science NEAR mathematics
 
  science NEAR mathematics
  
If you want to find two words that are near or further apart then you can add /n (where n is a number or words between the two words):
+
If you want to find two words that are near or further apart then you can add <code>/''n''</code> (where ''n'' is a number of words between the two words):
 
  science NEAR/3 mathematics
 
  science NEAR/3 mathematics
 
   
 
   
Line 19: Line 22:
  
 
== More complex queries ==
 
== More complex queries ==
You can combine the above three features in various ways:
+
You can ''combine'' the above three features in various ways:
 
  "supply change management" NEAR business
 
  "supply change management" NEAR business
 
   
 
   
 
  +"supply change management" -science
 
  +"supply change management" -science
 
   
 
   
Xapian has a much more complex query syntax than this but this is not directly available for the simple search web interface (e.g. http://example.eprints.org/cgi/search/simple).  However, it would be possible to create a separate search interface (available through a web browser or directly over HTTP without a human-readable web interface) that would allow you do even more specific or complex searches as described at https://xapian.org/docs/queryparser.html.
+
Xapian has a much more complex query syntax than this but this is not directly available for the simple search web interface (e.g. <nowiki>http://example.eprints.org/cgi/search/simple</nowiki>).  However, it would be possible to create a separate search interface (available through a web browser or directly over HTTP without a human-readable web interface) that would allow you do even more specific or complex searches as described at https://xapian.org/docs/queryparser.html.

Latest revision as of 14:38, 16 October 2019


If your repository has Xapian search enabled for "Simple Search" (e.g. http://example.eprints.org/cgi/search/simple). Then you can take advantage of some useful features to make more effective queries. You should be able to tell whether you have Xapian search enabled by checking whether you have the option by relevance match in the list of ordering options. This in itself can be useful, as it will rank results where the words you are searching for occur more frequently, which can be useful if the words are likely to match against a lot of items.

Specific Phrases

If you want to search for a specific phrase then ensure the whole phrase is within quote marks:

"supply change management"

Some words but not others

If you prepend the words you want to find with a + and the words you do not want to find with a -:

+science -engineering +mathematics

This word near another word

If you put the phrase NEAR between the two words then it will find matches where the words have 10 or less words in between:

science NEAR mathematics

If you want to find two words that are near or further apart then you can add /n (where n is a number of words between the two words):

science NEAR/3 mathematics

science NEAR/15 mathematics

More complex queries

You can combine the above three features in various ways:

"supply change management" NEAR business

+"supply change management" -science

Xapian has a much more complex query syntax than this but this is not directly available for the simple search web interface (e.g. http://example.eprints.org/cgi/search/simple). However, it would be possible to create a separate search interface (available through a web browser or directly over HTTP without a human-readable web interface) that would allow you do even more specific or complex searches as described at https://xapian.org/docs/queryparser.html.