dismax won't quite give you the same query result. What you can do
pretty easily, though, is create a QParser and QParserPlugin pair,
register it solrconfig.xml and then use &defType=<name registered>.
Pretty straightforward. Have a look at Solr's various QParserPlugin
implementations for details.
Erik
On Jan 29, 2010, at 12:30 AM, Abin Mathew wrote:
Hi I want to generate my own customized query from the input string
entered
by the user. It should look something like this
*Search field : Microsoft*
*
Generated Query* :
description:microsoft +((tags:microsoft^1.5 title:microsoft^3.0
role:microsoft requi
rement:microsoft company:microsoft city:microsoft)^5.0)
tags:microsoft^2.0
title:microsoft^3.5 functionalArea:microsoft
*The lucene code we used is like this*
BooleanQuery must = new BooleanQuery();
addToBooleanQuery(must, "tags", inputData, synonymAnalyzer, 1.5f);
addToBooleanQuery(must, "title", inputData, synonymAnalyzer);
addToBooleanQuery(must, "role", inputData, synonymAnalyzer);
addToBooleanQuery(query, "description", inputData, synonymAnalyzer);
addToBooleanQuery(must, "requirement", inputData, synonymAnalyzer);
addToBooleanQuery(must, "company", inputData, standardAnalyzer);
addToBooleanQuery(must, "city", inputData, standardAnalyzer);
must.setBoost(5.0f);
query.add(must, Occur.MUST);
addToBooleanQuery(query, "tags", includeAll, synonymAnalyzer, 2.0f);
addToBooleanQuery(query, "title", includeAll, synonymAnalyzer, 3.5f);
addToBooleanQuery(query, "functionalArea", inputData,
synonymAnalyzer,);
*
In Simple english*
addToBooleanQuery will add the particular field to the query after
analysing
using the analyser mentioned and setting a boost as specified
So there "MUST" be a keyword match with any of the fields
tags,title,role,description,requirement,company,city and it "SHOULD"
occur
in the fields tags,title and functionalArea.
Hope you have got an idea of my requirement. I am not asking anyone
to do it
for me. Please let me know where can i start and give me some useful
tips to
move ahead with this. I believe that it has to do with modifying the
XML
configuration file and setting the parameters in Dismax handler. But
I am
still not sure. Please help
Thanks & Regards
Abin Mathew