lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ingo Renner <i...@typo3.org>
Subject Cutom filter implementation, advice needed
Date Thu, 26 Aug 2010 19:07:58 GMT
Hi *,

I implemented a custom filter and am using it through a QParserPlugin. I'm wondering however,
whether my implementation is that clever yet...

Here's my QParser; I'm wondering whether I should apply the filter to all documents in the
index (I already guess it's a bad idea) or whether I should use the query as provided by the
already available query parser, see the parse() method.



	public AccessFilterQParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest
req) {
		super(qstr, localParams, params, req);

		QParserPlugin parserPlugin = req.getCore().getQueryPlugin(QParserPlugin.DEFAULT_QTYPE);
		QParser parser = parserPlugin.createParser(qstr, localParams, params, req);

		try {
			preConstructedQuery = parser.getQuery();
		} catch (ParseException e) {
			throw new RuntimeException(e);
		}

		String fieldName = localParams.get(AccessParams.ACCESS_FIELD, "access");

		this.accessFilter = new AccessFilter(fieldName, qstr);
	}

	@Override
	public Query parse() throws ParseException {

		Query allDocs = new MatchAllDocsQuery();

		// return new FilteredQuery(allDocs, accessFilter);
		return new FilteredQuery(preConstructedQuery, accessFilter);
	}


I'd be happy about any advice...


best
Ingo


-- 
Ingo Renner
TYPO3 Core Developer, Release Manager TYPO3 4.2, Admin Google Summer of Code

TYPO3 Enterprise Content Management System
http://typo3.org

Apache Solr for TYPO3 - Enterprise Search meets Enterprise Content Management
http://www.typo3-solr.com







Mime
View raw message