Search in sources :

Example 1 with IQueryParser

use of org.jboss.tools.hibernate.search.runtime.spi.IQueryParser in project jbosstools-hibernate by jbosstools.

the class AbstractHSearchService method search.

@Override
public List<Object> search(ISessionFactory sessionFactory, Class<?> entity, String defaultField, String analyzer, String request) {
    IFullTextSession session = getFacadeFactory().createFullTextSession(sessionFactory);
    IQueryParser queryParser = getFacadeFactory().createQueryParser(defaultField, getAnalyzerByName(analyzer));
    ILuceneQuery luceneQuery = queryParser.parse(request);
    IQuery query = session.createFullTextQuery(luceneQuery, entity);
    return query.list();
}
Also used : IQuery(org.jboss.tools.hibernate.runtime.spi.IQuery) IQueryParser(org.jboss.tools.hibernate.search.runtime.spi.IQueryParser) ILuceneQuery(org.jboss.tools.hibernate.search.runtime.spi.ILuceneQuery) IFullTextSession(org.jboss.tools.hibernate.search.runtime.spi.IFullTextSession)

Example 2 with IQueryParser

use of org.jboss.tools.hibernate.search.runtime.spi.IQueryParser in project jbosstools-hibernate by jbosstools.

the class FacadeFactoryImpl method createQueryParser.

@Override
public IQueryParser createQueryParser(String defaultField, IAnalyzer analyzer) {
    Analyzer luceneAnalyzer = (Analyzer) ((IFacade) analyzer).getTarget();
    QueryParser targetParser = new QueryParser(Version.LUCENE_34, defaultField, luceneAnalyzer);
    return new AbstractQueryParser(this, targetParser) {
    };
}
Also used : IQueryParser(org.jboss.tools.hibernate.search.runtime.spi.IQueryParser) QueryParser(org.apache.lucene.queryParser.QueryParser) AbstractQueryParser(org.jboss.tools.hibernate.search.runtime.common.AbstractQueryParser) AbstractQueryParser(org.jboss.tools.hibernate.search.runtime.common.AbstractQueryParser) Analyzer(org.apache.lucene.analysis.Analyzer) IAnalyzer(org.jboss.tools.hibernate.search.runtime.spi.IAnalyzer)

Aggregations

IQueryParser (org.jboss.tools.hibernate.search.runtime.spi.IQueryParser)2 Analyzer (org.apache.lucene.analysis.Analyzer)1 QueryParser (org.apache.lucene.queryParser.QueryParser)1 IQuery (org.jboss.tools.hibernate.runtime.spi.IQuery)1 AbstractQueryParser (org.jboss.tools.hibernate.search.runtime.common.AbstractQueryParser)1 IAnalyzer (org.jboss.tools.hibernate.search.runtime.spi.IAnalyzer)1 IFullTextSession (org.jboss.tools.hibernate.search.runtime.spi.IFullTextSession)1 ILuceneQuery (org.jboss.tools.hibernate.search.runtime.spi.ILuceneQuery)1