lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Leedy <lee...@vtls.com>
Subject New equivalent to QueryParsing.parseQuery()?
Date Wed, 07 May 2014 18:42:21 GMT
I have some older code that works as expected in Solr 3.4:

            final IndexSchema indexSchema = new IndexSchema(
              new SolrConfig(solrHome +
"/repository","solrconfig.xml",null), "schema.xml", null);
            final Query luceneQuery = QueryParsing.parseQuery(
                  query, "text", indexSchema);
            luceneIndex.getIndexSearcher().search(luceneQuery, collector);

This appears to suck in all of the good stuff from the solrconfig.xml and
schema.xml, which is great. However, for Solr 4.0, I'm trying to find an
equivalent to QueryParsing.parseQuery() (which no longer exists) that lets
me incorporate these config files as before. I'm (naively?) trying the
following:

        final StandardQueryParser parser = new StandardQueryParser();
        final Query luceneQuery = parser.parse(query, "text");
        luceneIndex.getIndexSearcher().search(luceneQuery, collector);

However, the behavior of the StandardQueryParser seems to be different
enough to make some previously good queries fail, and I've not found a new
way to incorporate the xml config files. It seems silly to manually
reconstitute the relevant analyzers, filters, etc. from the schema in this
query code in my application. Is there a 4.0 equivalent to the older code
that works similarly, or are things more complicated?

Thanks in advance...

Jeff




--
View this message in context: http://lucene.472066.n3.nabble.com/New-equivalent-to-QueryParsing-parseQuery-tp4135050.html
Sent from the Solr - User mailing list archive at Nabble.com.

Mime
View raw message