Page 1 of 1

Exact Text Search with Find Webservice

PostPosted:Mon Mar 17, 2014 6:19 am
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?

Re: Exact Text Search with Find Webservice

PostPosted:Tue Mar 18, 2014 5:46 am
by Raphel
Any suggestion on my above query?

Re: Exact Text Search with Find Webservice

PostPosted:Sat Mar 22, 2014 9:21 am
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.