[hibernate-issues] [Hibernate-JIRA] Commented: (HSEARCH-414) Add support for a Lucene query builder using a fluent API
Emmanuel Bernard (JIRA)
noreply at atlassian.com
Fri Apr 16 12:18:58 EDT 2010
[ http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-414?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=36476#action_36476 ]
Emmanuel Bernard commented on HSEARCH-414:
------------------------------------------
I've made significant changes (as in break pretty much everything :) ). Let me know what you think
It looks cleaner now. You have several well defined layers:
- chose the type of query (exact, fuzzy, wildcard)
- (optional) customize query level operations (boost, constant score, filter)
- select the targeted field
- (optional) customize field level operations (boost, ignoreAnalyzer)
- select the text to match
- create the Lucene query
I plan to add multi field queries as well.
Questions:
- does the query level vs field level distinction make sense?
- fuzzy() or approximate() ?
Examples:
{code}
final QueryBuilder monthQb = fts.getSearchFactory()
.buildQueryBuilder().forEntity( Month.class ).get();
Query
//term query based on several words
query = monthQb.exact().onField( "mythology" ).matches( "colder darker" ).createQuery();
//fuzzy search with custom threshold and prefix
query = monthQb
.fuzzy()
.threshold( .8f )
.prefixLength( 1 )
.onField( "mythology" )
.matches( "calder" )
.createQuery();
//wildcard query
query = monthQb
.wildcard()
.onField( "mythology" )
.matches( "mon*" )
.createQuery();
//combined query, January and february both contain whitening but February in a longer text
query = monthQb
.bool()
.should( monthQb.exact().onField( "mythology" ).matches( "whitening" ).createQuery() )
.should( monthQb.exact().onField( "history" ).matches( "whitening" ).createQuery() )
.createQuery();
{code}
> Add support for a Lucene query builder using a fluent API
> ---------------------------------------------------------
>
> Key: HSEARCH-414
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-414
> Project: Hibernate Search
> Issue Type: New Feature
> Components: query
> Reporter: Emmanuel Bernard
> Fix For: 3.3.0
>
>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list