How can i use multiple Boolean operators in a search query.? For example , from the search text field , i usually get the queries which looks like
Any (word or phrase) and ( a list of URI's) example:: rice land http\://www.wtr.org/wordlist#c_2379 http\://www.wtr.org/wordlist#c_65748 http\://www.wtr.org/wordlist#c_7612 here the search term or phrase is = rice land URIs are= http\://www.wtr.org/wordlist#c_2379 http\://www.wtr.org/wordlist#c_65748 http\://www.wtr.org/wordlist#c_7612 Now the way i want to build the Query is:: rice land AND ( http\://www.wtr.org/wordlist#c_2379 OR http\://www.wtr.org/wordlist#c_65748 OR http\://www.wtr.org/wordlist#c_7612 ) i tried this- try { if (queryString != null && fields != null) { PerFieldAnalyzerWrapper perFieldAnalyzer = new PerFieldAnalyzerWrapper(analyzer); perFieldAnalyzer.addAnalyzer("conceptURI", new KeywordAnalyzer()); MultiFieldQueryParser mfqp = new MultiFieldQueryParser( fields, perFieldAnalyzer); if (queryString.contains("http") && !queryString.startsWith("http")) { String orgQuery =queryString.substring(0, queryString.indexOf("http")); String uri=queryString.substring(queryString.indexOf("http"), queryString.length()); uri = uri.trim(); String[] uris = uri.split(" "); String tempUri=""; for (int i = 0; i < uris.length; i++) { if(i== uris.length-1){ tempUri = tempUri + uris[i]; }else { tempUri = tempUri + uris[i]+QueryParser.OR_OPERATOR; } } query = mfqp.parse(orgQuery+ QueryParser.AND_OPERATOR+ tempUri ); is this is the correct way to form a Query..?? Are there any other methods? -- View this message in context: http://www.nabble.com/Grouping-of-Boolean-opeartors-in-Lucene..--tp20453434p20453434.html Sent from the Lucene - Java Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]