Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 367702 - Make properties from DisMaxParams-class configurable at IQuery-Objects
Summary: Make properties from DisMaxParams-class configurable at IQuery-Objects
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: gyrex (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Konrad Schergaut CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-02 06:19 EST by Konrad Schergaut CLA
Modified: 2018-03-19 11:59 EDT (History)
1 user (show)

See Also:


Attachments
Ideas on how a solution for this might look like (9.26 KB, patch)
2012-01-02 07:30 EST, Konrad Schergaut CLA
no flags Details | Diff
Changes to support of more generic query options (6.44 KB, patch)
2012-01-02 08:57 EST, Konrad Schergaut CLA
gunnar: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Konrad Schergaut CLA 2012-01-02 06:19:15 EST
Build Identifier: 

For some more customized search requirements, we need to add more configurable fields to the IQuery-Objects.
For a specific scenario, we need the ability to set the fields specific for DisMaxParser parameters (especially the "qf"-field).
For not blowing up the interface of this class to much, we might use some AttributeSets or sub-interfaces. This is furthermore useful since this fields are not required to be set if other parsers then DisMax are used.

Reproducible: Always
Comment 1 Konrad Schergaut CLA 2012-01-02 07:30:19 EST
Created attachment 208914 [details]
Ideas on how a solution for this might look like

I had a look at the sources and tried to add some DisMax-Support with some small changes.
This first attempt just adds the query fields I need in my specific case, but extending it to support the other DisMaxQuery-specific fields later on might be a good ideas as well.
Comment 2 Gunnar Wagenknecht CLA 2012-01-02 08:39:59 EST
I don't like the IDisMaxQuery query approach. "DisMax" is a very Solr specific thing. I think we should use a simpler approach which would also be more generic an in-line with our existing advanced query approach.

In essance, we just need the following new method in IQuery:

/**
 * Sets a query option.
 * <p>
 * Query options provide a capability to influence the query in an
 * implementation specific way. It's completely up to the underlying search
 * implementation which options are supported. Thus, any query option must
 * be considered implementation specific which tightly couples clients to a
 * specific implementation. However, using this API method should help with
 * an easier discovery and management of such tight couplings.
 * </p>
 * <p>
 * Warning, query options may influence (eg., override or disable) any of the
 * other query features configured via calls to any of the other methods
 * specified by this interface.
 * </p>
 * 
 * @param name
 *            the option name (must not be <code>null</code>)
 * @param value
 *            the option value (maybe <code>null</code> to unset an option)
 * @return this query object for convenience
 */
IQuery setQueryOption(String name, String value);

and a getter (also with appropriate JavaDoc ;)).

The options should be saved into a LinkedHashMap and the BaseSolrSearchManager should apply them 1:1 as SolrQuery params. Query options may override or disable any of the default features. Thus they should be applied last.
Comment 3 Konrad Schergaut CLA 2012-01-02 08:57:00 EST
Created attachment 208916 [details]
Changes to support of more generic query options

I changed it according to your suggestions and added another patch.
Comment 4 Gunnar Wagenknecht CLA 2012-01-02 09:13:35 EST
Patch committed without the #add method. Let's see if there will ever be a use case for such a method.

Thanks Konrad!