Sitecore indexing Boost Rule based on search term - sitecore

How exactly do boost rules work for page items in context to search results? Ideally I would like a rule on a page that is essentially:
Condition: When search term is 'A'
Action: Boost score to 10
The closest thing I have found is this blog post about testing the query parameter via the 'when script returns true' condition but am having no luck in Sitecore 8. Thanks for any ideas.

Related

REGEX in GA view filter (search and replace) to output a numeric ID from URI

I'd like to search and replace in Google Analytics view filter all my Request URIs in such a way that just the article id remains (plus, to add an "a-" before the ID).
Example URIs:
/raksts/sievietem/281750-ilona-balode-par-dzivi-ar-udriti-no-mums-beg-ka-no-grimstosa-kuga
/raksts/zinas/281427-video-izskatas-ka-spelu-automatu-atkariba-baibu-strautmani-nelaiz-vala
/raksts/arzemes/282070-pasauli-savilno-mazas-princeses-sarlotes-emocijas-karaliskajas-kazas
/raksts/izklaide/280379-turpinas-tirisana-jrt-maru-kimeli-atlaiz-hermana-sieva-aiziet-pati
The result I'm after:
a-281750
a-281427
a-282070
a-280379
In Regex checking sites it works like a charm, Regex being:
\/raksts\/\D+(\d+).+
Substitution being:
a-$1
But when I apply them to a GA filter, the checker tells me that the filter wouldn't have changed any data.
Not sure if I need to do this in GA - Data Studio would do too, the endgame being exported article IDs for our IT guys to implement in our editorial interface through Google API.
Probably a dumb question for which I apologize, but I feel quite stuck, so even a hint in the right direction will be greatly appreciated.
Try to add backslash before 1:
a-\1

Sitecore Lucene.net search with " Item name" only and sort it by hits

Hi how can we search an items name (http://screencast.com/t/vRAUNgQN) using Lucene.net in Sitecore and sort the search by the hits.
This shouldn't really be a question as there are lots of resources out there for this. This is my goto place for search:
http://www.sitecore.net/learn/blogs/technical-blogs/sitecore-7-development-team.aspx
I'll give you the benefit of the doubt though and get you started.
If you are using Sitecore 7 and above you can use the Linq style search.
using (var context = new ContentSearchManager.GetIndex("indexname").CreateSearchContext())
{
IQueryable<SearchResultItem> query =context.GetQueryable<SearchResultItem> ().Where(p=> p["name"].Equals("John"));
}
You can then call
SearchResults<SearchResultItem> results = query.GetResults();
This will have a hits collection
foreach (var hit in results.Hits)
{
hit.Document.Id;
var relevance = hit.Score;
........
Each hit will have a Score property which determines relevance (see above) - you should be able to sort by this. By default I think it sorts by relvance anyway. You can change the relvency by using the Boost function in the query.
For Sitecore 6.6
I'm a big fan of advanced database crawler module - it provides a nice wrapper for the search logic that sits on top of the standard search api.
http://sitecoresupport.blogspot.co.uk/2013/05/advanced-database-crawler-sitecore.html
Bear in mind though if you upgrade to 7 there are compatibility issues with this module.
Or you can use the standard Sitecore search api
https://sdn.sitecore.net/upload/sdn5/articles%202/administration/lucene%20search/lcd/lucene_search_engine-a4.pdf
I'm sure you'll figure the rest out

Cloudsearch Fuzzy terms and phrases

I am trying to get my head around how fuzzy search works on AWS CloudSearch
I want to find "Star Wars" but in my search, I spell it
ster wers
The logic of my app will add fuzzy but it never returns Star Wars.
I have tried:
ster~1 wers~1
"ster wers"~2
"ster"~1 "wers"~1
What am I missing here?
The reason your query doesn't work is because of how CloudSearch stems. If your field is indexed with the Analysis Scheme set to English, then wars will be stored in its stemmed form as war.
Here's a little demo of how stemming is affecting your query.
Searching with the un-stemmed query ('ster wers'):
Searching with the un-stemmed query requires you to match wers to war, which is off by 2 chars and requires this query: q=ster~1+wers~2.
Searching with the stemmed query ('ster wer'):
Searching with the stemmed version means you're matching wer to war and you're only off by 1 char. Thus ster~1 wer~1 will get the desired result (ie it matches star wars).
How to fix:
The use case you described will work if you configure the Analysis Scheme for the field in question to not use any stemming.
To do this, log into the AWS Web Console and go to Analysis Schemes --> Add Analysis Scheme:
Then go to Indexing Options and configure your field to use your new no-stemming analysis scheme:
Submit your changes and re-index.
That will address your issue but of course you'll lose the benefits of stemming. You can't have your cake and eat it too.

CF10 Fieldboost on cfindex has no effect

Maybe this is a new, mostly unused feature, but I am trying to create a collection based on a query from our DB. It's a simple Q&A and I'd like to rank the matches in the question higher than the answer. Seems logical as currently a search for "register for classes" the question "How do I register for classes" ranks lower than "How to I purchase books for my classes" because content in the books answers I guess matches better. So I'd like to bump the Q&A's if the question matches really well to the text in the query.
CF10 has a "Fieldboost" field on the cfindex however this is having 0 effect on results. I add it and remove it and nothing changes. The score and rank stays the exact same.
<cfindex action="refresh" collection="faq"
type="custom"
title="question"
body="question,answer"
fieldboost="question:6"
key="faq_id"
query="updateQuery"
location_i="location_id" />
`
So I searched Raymond Camden's site and found a little answer that I thought I had tried earlier, but maybe my syntax was wrong. I am using title:#URL.q#^2 which is working to boost the value of title in the search.
While this works, the CF10 docs indicate I should be able to do this with the fieldboost property, which I still cannot get to work.
According to the Solr documentation any field that is to be boosted must have omitNorms="false" in schema.xml. The default is false but is it possible it is being set to true in your schema.xml? The other issue I see in the above CFINDEX statement is that you're not specifying a field name in your fieldboost parameter, but rather a query column. If you want to boost on title then perhaps you need
<cfindex ... fieldboost="title:6" ... />
?

Solr Query Syntax

I just got started looking at using Solr as my search web service. I don't know whether Solr supports these query types:
Startswith
Exact Match
Contain
Doesn't Contain
In the range
Could anyone guide me how to implement those features in Solr?
Cheers,
Samnang
Solr is capable of all those things but to adequately explain how to do each of time an answer would become a mini-manual for Solr.
I'd suggest you read the actual manual and tutorials linked from the Solr homepage.
In short though:
Startswith can be implemented using Lucene wildcards.
Exact matches will only be found if a field is not tokanized. I.e. the entire field is viewed as a single token.
Contain is the default search format. I.e. a search for "John" will find any document's whose search field contains the value "John". Prefixing with - (e.g. "-John" will only find documents that do not contain John).
Ranges (be they date or integer) are possible and quite powerful, example date:[* TO NOW] would find any document whose date is not in the future.