cancel
Showing results for 
Search instead for 
Did you mean: 

What is the "Free Text Query" tab on SolrIndexedProperty used for

0 Kudos

Hi,

There are the same Free Text Query tab on SolrIndexedProperty and SolrSearchQueryProperty.

I know if I put attribute on SolrSearchQueryProperty, the attribute can be searchable and configure on Free Text Query tab.

But if I configure on SolrIndexedProperty, nothing happens.

So what is the purpose function for the Free Text Query tab on SolrIndexedProperty ?

Cheers,

Rafi

Accepted Solutions (1)

Accepted Solutions (1)

mansurarisoy
Contributor

The tab for SolrIndexedProperty is used when there is no SearchQueryTemplate is defined.

In SearchSolrQueryPopulator class SearchQuery is generated with the following method call

final SearchQuery searchQuery = facetSearchService.createFreeTextSearchQueryFromTemplate(facetSearchConfig, indexedType,
queryTemplateName, freeTextSearch);
If you navigate createFreeTextSearchQueryFromTemplate method of DefaultFacetSearchService you will see the following codes
SearchQueryTemplate queryTemplate = this.findQueryTemplateForName(indexedType, queryTemplateName);
if (queryTemplate != null) {
    SearchQuery searchQuery = this.createSearchQuery(facetSearchConfig, indexedType);
    // Populating other fields
    if (StringUtils.isNotBlank(userQuery)) {
        this.populateFreeTextQuery(facetSearchConfig, indexedType, queryTemplate, searchQuery, userQuery);
    }
    return searchQuery;
} else {
    // This is used when no SearchQueryTemplate is defined
    return this.createFreeTextSearchQuery(facetSearchConfig, indexedType, userQuery); 
}
If you navigate to the createFreeTextSearchQuery method which is used when no template is defined you'll see the following
If you navigate to the createFreeTextSearchQuery method which is used when no tempalate is defined you'll see the following

public SearchQuery createFreeTextSearchQuery(FacetSearchConfig facetSearchConfig, IndexedType indexedType, String userQuery) {
  SearchQuery searchQuery = this.createSearchQuery(facetSearchConfig, indexedType);
  // Populating other fields
  if (StringUtils.isNotBlank(userQuery)) {
      this.populateFreeTextQuery(facetSearchConfig, indexedType, searchQuery, userQuery);
  }

  return searchQuery;
}
In the method populateFreeTextQuery() there are usages of IndexedProperty's fts fields like
if (indexedProperty.isFtsQuery()) {
    searchQuery.addFreeTextQuery(indexedProperty.getName(), indexedProperty.getFtsQueryMinTermLength(), indexedProperty.getFtsQueryBoost());
}
Similarly in the method populateFreeTextQuery() which is used when a SearchQueryTemplate is defined, there are usages of SearchQueryPropety's fts fields
if (searchQueryProperty.isFtsQuery()) {
    searchQuery.addFreeTextQuery(searchQueryProperty.getIndexedProperty(), searchQueryProperty.getFtsQueryMinTermLength(), searchQueryProperty.getFtsQueryBoost());
}
Hope this helps,

ahh I see.. already debug that and try to make empty on SearchQueryTemplate, the attributes on SolrIndexedProperty was used for search.
Thank you mansurarisoy for explain the code flow.

Answers (1)

Answers (1)

former_member506
Participant
0 Kudos

Free Text Query

This an exact match search. Only when the exact keyword is found in the solr index, you will get a result. Do note that this does not mean it has to match the entire value. In the case of real test solr considers real and test separate keywords. If you would search for multiple keywords, for example on "real test" solr would search for the keyword "real" and the keyword "test"

Free Text Fuzzy Query

Fuzzy queries are used when you allow for mistakes in your searches. This means that you will also match search keywords that have a few wrong characters. The fuzzyness factor determines how much can be wrong for the result to show up. Note that the fuzzy search does not have wildcards. It behaves more like an exact match.


Your case only free text is enabled and not fuzziness. SO word search should work, considering all other things are fine.

0 Kudos

Hi pavankumar_joshi thanks for the answer,

But what I ask here is about the Free Text Query tab section, not the search configuration(free text, fuzzy, wildcar, phrase).

there are the same tab section on SolrIndexedProperty and SolrSearchQueryProperty. but nothing happens if I configure it on SolrIndexedProperty.

former_member506
Participant
0 Kudos

Hello...
Free text query properties only I meant.. and also better to set some min length on free text like 3/4 too.

What is your expectation from your query property settings above ?