Use Liferay 7.2 Elastisearch Custom Filter to exclude all Web Content Articles with specific tag - liferay

I'm attempting to exclude all Web Content Articles with tag "no-search" applied to them from appearing in search results. However, I'm having difficulty figuring out how to set up the Custom Filter widget for that.
Here's what I have:
Filter Field: tagNames (have also tried assetTagNames)
Filter Value: no-search
Filter Query Type: Exists (have tried everything in the list with no success)
Occur: must_not
The documentation isn't being terribly useful for this. I even tried other example filter parameters provided on this page and they didn't function as expected either. What parameters do I need to use to do this successfully?

Answering for myself, since I ended up reaching out to Liferay support for help with this, and so this is accessible to anyone searching for it in the future. Here's what they told me to use.
Filter Field: assetTagNames
Filter Value: no-search (or your own exclusion tag here)
Filter Query Type: Match
Occur: must_not

Related

Customize search results and facets in Liferay 7.1

this is my first question, thanks in advance.
I am trying to customize the liferay results portlet and facets, with custom results. I need to filter the results once the search is launched, and remove the results that do not have layoutId :
with->
layoutIds = journalContentSearchLocalService.getLayoutIds(groupId,false,articleIdResult);
I´m doing this in a jsp fragment, but i think that it´s not correct.
I have been searching and i think the correct way is to modify the java class with the action, for example with acction coomand hook, is this correct?
Please, can you explain me the correct way to modify this functionalities?
Regards!!
ok. it looks you want result of journalarticle having display page is set. in that case, you need to look for JournalarticleModelPreFiltercontributor component extension or journalarticlepostprocessor if you are using legacy search api. when article gets indexed layoutuuid field is also indexed for each article. that field will have value if display page is set for specific web content or article.
So, you can use any of the above mentioned way to add check that this field should not be empty as search term. which will filter your result in request itself. instead adding overhead on result as later filtering in jsp.

Returning accented as well as normal result set via azure search filters

Does anyone know how to ensure we can return normal result as well as accented result set via the azure search filter. For e.g the below filter query in Azure search returns a name called unicorn when i check for record with name unicorn.
var result= searchServiceClient.Documents.SearchAsync<myDto>("*",new SearchParameters
{
SearchFields = new List<string> {"Name"},
Filter = "Name eq 'unicorn'"
});
This is all good but what i want is i want to write a filter such that it returns record named unicorn as well as record named únicorn (please note the first accented character) provided that both record exist.
This can be achieved when searching for such name via the search query using language or Standard ASCII folding search analyzer as mentioned in this link. What i am struggling to find out is how can we implement the same with azure filters?
Please let me know if anyone has got any solutions around this.
Filters are applied on the non-analyzed representation of the data, so I don’t think there’s any way to do any type of linguistic analysis on filters. One way to work around this is to manually create a field which only do lowercasing + asciifloding (no tokenization) and then search lucene queries that look like this:
"normal search query terms" AND customFilterColumn:"filtérValuèWithÄccents"
Basically the document would both need to match the search terms in any field AND also match the filter term in the “customFilterColumn”. This may not be sufficient for your needs, but at least you understand the art of the possible.
Using filters it won't work unless you specify in advance all the possibilities:
for example:
$filter=name eq 'unicorn' or name eq 'únicorn'
You'd better work with a different analyzer that will change accents to it's root form. As another possibility, you can try fuzzy search:
search=unicorn~&highlight=Name

Azure Search Autocomplete API not working for Fuzzy search

I have configured azure autocomplete API with all parameters. It gives results for normal keywords but when I tried with misspell keyword then it doesn't provide me expected results. Also, I have added UseFuzzyMatching=true while configuration.
eg. machine -> gives the expected results. If we try with magine then it provides 0 results from autocomplete API.
Please let me know if I'm missing any configurations to make Fuzzy workable.
I have data in my index that contains product description and comment fields 'Boormachine' or 'machine', also it provide me result in search API for this.
I have configured suggester while creation of index with the following source fields:
Comment, CommentSmall, Description,
ItemBrandDescription, Itemcode,
ItemGroupDescription,ItemSupplierCode,
SupplierCode
We have configured autocomplete API with this:
as I need to find for keyword suggestions not in group and brand name so excluded these two fields from search fields in configuration.
We can see fuzzy related configuration in autocomplete with UseFuzzyMatching flag. Please let me know if I am missing some configuration to work fuzzy in azure search autocomplete API.
For References click this Link
The behavior Azure Search is providing is correct.
Magine is a different term than machine, and probably it does not exist in your index, this is why you're getting 0 results. To enable Fuzzy Search you actually need to append the ~ symbol to the term, so your search will look like:
"search=magine~"
https://learn.microsoft.com/en-us/azure/search/query-lucene-syntax#bkmk_fuzzy

drupal search for a specific content type along with its node type for comments

I have a content type called 'ticket'; its Node type for comments is 'interaction'.
I want a search interface which searches through only these two (ticket,interaction) content-types; and output the node-link/title
Also, even though matches are found in interactions, i should be displaying the respective ticket node-link/title. (since interaction are actually the comments for the ticket node)
Can anybody please help me achieve this?
Thanks!
You should try using the Views module in conjunction with the core search module. You can create a view, filter the content type to ticket, and then add an exposed "Search: Search Terms" filter to your view.
Of course you could also write a quick custom module and do your own query.

How to implement faceted search suggestion with number of relevant items in Solr?

Hi
I have a very specific need in my company for the system's search engine, and I can't seem to find a solution.
We have a SOLR index of items, all of them have the same fields, with one of the fields being "Type", (And ofcourse, "Title", "Text", and so on).
What I need is: I get an Item Type and a Query String, and I need to return a list of search suggestion with each also saying how meny items of the correct type will that suggested string return.
Something like, if the original string is "goo" I'll get
Goo 10
Google 52
Goolag 2
and so on.
now, How do I do it?
I don't want to re-query SOLR for each different suggestion, but if there is no other way, I just might.
Thanks in advance
you can try edge n-gram tokenization
http://search.lucidimagination.com/search/document/CDRG_ch05_5.5.6
You can try facets. Take a look at my more detailed description ('Autocompletion').
This was implemented at http://jetwick.com with Solr ... now using ElasticSearch but the Solr sources are still available and the idea is also the identical https://github.com/karussell/Jetwick
The SpellCheckComponent of Solr (that gives the suggestions) have extended results that can give the frequency of every suggestion in the index - http://wiki.apache.org/solr/SpellCheckComponent#Extended_Results.
However, the .Net component SolrNet, does not currently seem to support the extendedResults option: "All of the SpellCheckComponent parameters are supported, except for the extendedResults option" - http://code.google.com/p/solrnet/wiki/SpellChecking.
This is implemented using a facet field query with a Prefix set. You can test this using the xml handler like this:
http://localhost:8983/solr/select/?rows=0&facet=true&facet.field=type&f.type.prefix=goo

Resources