Community
Participate
Working Groups
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
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.
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.
Created attachment 208916 [details] Changes to support of more generic query options I changed it according to your suggestions and added another patch.
Patch committed without the #add method. Let's see if there will ever be a use case for such a method. Thanks Konrad!