Difference between revisions of "Search with Xapian Guide"

From EPrints Documentation
Jump to: navigation, search
(Added some content for specific fields text o)
(Added some useful help on using Xapian Search)
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 make use of the Xapian search syntax to make more complex queries, which needing to use advanced search.  This may be useful if you have another website you wish to search your EPrints repository with a specific filter on the results returned (e.g. only results for a particular faculty of department).  Below is a guide to some of the syntax that can be used with Xapian-based search.
 
If your repository has Xapian search enabled for "Simple Search" (e.g. http://example.eprints.org/cgi/search/simple).  Then you can make use of the Xapian search syntax to make more complex queries, which needing to use advanced search.  This may be useful if you have another website you wish to search your EPrints repository with a specific filter on the results returned (e.g. only results for a particular faculty of department).  Below is a guide to some of the syntax that can be used with Xapian-based search.
  
== Specific fields ==
+
== Specific Phrases ==
 +
If you want to search for a specific phrase then ensure the whole phrase is within quote marks, e.g :
 +
"supply change management"
  
=== Text only ===
+
== 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 ''''-'''.  E.g.
 +
+science -engineering +mathematics
  
Search for phrase '''science''' in the field '''title'''
+
== This word near another word ==
  title:(science)
+
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
  
Search for the phrase '''smith''' in the field '''creators_name'''
+
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):
  creators_name:(smith)
+
science NEAR/3 mathematics
 +
 +
  science NEAR/15 mathematics
  
Exact multiple word phrases can also be search for, such at the phrase '''biological science''' in the field '''abstract'''
+
== More complex queries ===
  abstract:(biological science)
+
You can combine the above three features in various ways:
 
+
"supply change management" NEAR business
The field names that can be searched under to match a text phrase are as follows:
+
* abstract
+
  +"supply change management" -science
* contributors_name
+
* creators_name
+
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 is 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.
* divisions
 
* editors_name
 
* subjects
 
* title
 
* type
 
 
 
 
 
 
 
== AND ==
 
 
 
== OR ==
 
 
 
== NOT ==
 
 
 
== ANDs and ORs ==
 
 
 
== More complex queries ==
 

Revision as of 16:29, 25 July 2017

If your repository has Xapian search enabled for "Simple Search" (e.g. http://example.eprints.org/cgi/search/simple). Then you can make use of the Xapian search syntax to make more complex queries, which needing to use advanced search. This may be useful if you have another website you wish to search your EPrints repository with a specific filter on the results returned (e.g. only results for a particular faculty of department). Below is a guide to some of the syntax that can be used with Xapian-based search.

Specific Phrases

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

"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 '-. E.g.

+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 or 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 is 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.