• Exact Text Search with Find Webservice

  • OpenKM has many interesting features, but requires some configuration process to show its full potential.
OpenKM has many interesting features, but requires some configuration process to show its full potential.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #28118  by Raphel
 
Hi,

We are using OpenKM 6.2.5 and are implementing full text search with Find webservice. I am trying to implement a exact text search with multiple words. OpenKM's default search behavior seems to be to split the text into separate tokens and search for each token with the 'AND' criteria to join the final result.
For example, if I have the following code to search from a list of countries using Find webservice,
Code: Select all
QueryParams queryParams = new QueryParams();
queryParams.setDomain(1L);
queryParams.setPath("/okm:root/Test/");
String searchText = "France Greece";
queryParams.setContent(searchText);

List<QueryResult> resultList = okmSearch.find(token, queryParams);
My requirement is the search should return only documents which have 'France' and 'Greece' as consecutive texts(Exact Match). But the Find webservice returns all documents which have both 'France' and 'Greece' texts, irrespective of where they appear in the document. I tried escaping the text with \" also, but then it didn't return any result. In this scenario, how can I make OpenKM Find webservice to understand the search has to be made on the entire search text as a single token, rather than it's default behavior?
 #28166  by pavila
 
According to the Lucene syntaxis this query should be "France Greece", but the QueryParams parser doesn't work nice with this literal. I will try to improve it, but meanwhile you can use another method:
Code: Select all
List<QueryResult> resultList = OKMSearch.getInstance().findSimpleQuery(null, "\"France Greece\"")
Note the protected " inside the search string.

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.