Can a Sitecore Lucene index be programmatically built? - indexing

When using Lucene indexing in Sitecore, is it possible to add items to an index based on the content of an item? Indexes can be built based on template id but I would like to add additional criteria to filter items before they are added to the index.

I am not sure exactly what you mean. The headline seems different than the body?
Anyways, from the actual question, I understand that you'd like to add items only if a given criteria is meet? It could for instance be - only add items that are based on template X.
As far as I know, the responsibility for getting data for the index lies with the ItemCrawler. The standard ItemCrawlers are based on paths (e.g. everything under /Sitecore/home is indexed). I am thinking you could make your own ItemCrawler and use that in your index instead.
Here are some examples of a custom item crawlers:
http://mityasctech.blogspot.com/2016/10/create-custom-sitecore-search-crawler.html
http://mrstevenzhao.blogspot.com/2014/04/sitecore-custom-item-crawler.html
I hope this can help you.

Related

How to click on a link in a specific row of dynamically loaded table

I have a table similar to below in a WPF application.
We are using Silk Test 17.5 using VB.NET.
Table is dynamically loaded based on latest data.
I need to click on 'Default' ( Link) for specific row.
e.g. I need to click on 'Default' link for Trump1 , Trump2 row.
How should I do it? All locators of default links are same and I cannot differentiate between them.
Is there any I can append First Name locator to Default to figure out which locator to click?
Tokci
SilkTest has a framework for supporting such custom controls and a nice tutorial here
Theoretically you would have to:
List all the methods on the control
From the previous listing (or by talking with the developers) look up the method to access the rows inside the control
Filter your rows and get the one which is interesting for you
From the row you can get the cell by following the same pattern(find out the method which gives acces to it, get it, filter)
Click on the Link
Of course as the tutorial tells you, if you do not want to always do these iterations you should create some higher level utilities where you can just get the Cell at once. Example: GetGridViewRowCell(gridView, cellRow, cellColumn) where cellRows can be a more sophisticated filter object where you describe which cell must have which value in order to identify the proper row
Assuming the table has a hierarchical structure similar to HTML, you should be able to do the following:
Locate a cell in the row you are looking for that is easy to find, e.g. //WPFDataGridCell[#text='Obama'].
From that cell, move up the hierarchy one step using ...
Now you're in the correct WPFDataGridRow, search down again for the row's "Default" link with //WPFHyperLink[#caption='Default'].
Putting it all together, you'll get a locator like //WPFDataGridCell[#text='Obama']/..//WPFHyperLink[#caption='Default'].
Of course this is only an example based on the information you provided, so if you try it, make sure to pick the attributes with Silk Test's locator spy to make sure you get the correct values.

Splunk Custom Index Searching

I created my own index in Splunk to be used by the HTTP Event Collector. When I look at the Indexes view, I see that there are events in my index.
However, when I go into the Search App, and look at the Data Summary, on the Sources tab, I am not seeing any entry for my index.
I was using a different token for HEC previous to this, pointing to the 'main' index, and that data is there, as source type 'json_no_timestamp'. But when I pointed to my own index, I can't get it to show in Search.
One interesting thing I noticed is that in the Index view, all the other entries show 'system' in the 'App' column, whereas my index has 'search' there instead.
Do I need to do something to get my index to show up?
I needed to use the 'index="myIndex"' parameter in the search. Unfortunately, it looks like my index just won't show up in the Data Summary, though - it looks like that always defaults to 'main'.

How to Implement dynamic search using RavenDB?

I am using RavenDB to store data in documents which I want to query later dynamically for generating some visual charts. I have an ASP.Net interface where the user can apply filters, include exclude certain criteria. This is a normal requirement in search pages and I thought RavenDB is perfect for it. However I am not sure how to generate the filters dynamically, do I need to create index on all fields in advance?
In one thread I read about LuceneQuery but there is no simple example out there documenting how to apply and remove filter criteria dynamically via LuceneQuery.
Kindly help and suggest how I can implement it. With Entity Framework I simple used to build the expression dynamically based on some values and then pass it in where clause.
Update: Ok so to be more specific I have a page where I am generating charts using dynamic queires. User has multiple filters that he can modify like, Year From, Year To, Category, Sub Category, Sales By Specific Salesman etc.
All this data is stored in one table or document so to speak. I want to group data based on user filters which can only be determined at run time, then execute a query that fethches result using "AND" operator among the filters. So that only those records that exactly match the criteria (Not the scores that Lucene calculates during search) are grouped and summary is returned so that I can generate charts on them. Hope I made sense this time

Showing more feature attributes in Solr Highlight

How can I get more feature fields from Solr highlight output?
Currently the Highlight just returns the text snippet and docID.
During the indexing step I indexed the feature alongside with other fields I'd like to get back.
Thank you in advance!
You can specify other fields to return highlighting on using the hl.fl parameter. For multiple extra fields, just use that field repeatedly. For example, if you want to highlight in the fields author and title, you would append
&hl.fl=author&hl.fl=title
to your Solr query. Take a look at the linked page for other highlighting options.

How to filter a Sharepoint List Column with a Textbox Control Value using a "Contains" query?

I'm using a data view to display a list (Sharepoint 2010) that has several columns including one that has a Name column. I've provided the user with a text filter on the page to send values to filter the Name column in this list. The problem I'm facing is that the filter only works for exact matches and not partial matches.
I tried to overcome this problem by using Sharepoint Designer to:
create a parameter that uses the textbox control value.
Filtering the Name column with this parameter and setting the comparison to "Contains"
Unfortunately if the default value of the Parameter is blank, the list does not display any data. If the default value of the parameter is set to part of a name in the list, the list displays names that contain that string. However, when changing the value in the text box and searching, the list does not return results. Please let me know if you guys know how to fix this. Any help is much appreciated and let me know if you need any additional information. Thanks!
Managed to find a solution to my problem. I used a custom javascript solution designed by jvossers (http://instantlistfilter.codeplex.com) that involves the list being filtered instantly much like Google's search!
The only downside of this solution is that it only filters the items currently displayed on the screen. Therefore, if you have a data view web part which limits the amount of items displayed on the page, this solution won't help you. In order to facilitate this solution, display all the row items on the page (by increasing the item limit per page to a larger number than your total list rows) and then add this code into a content editor web part on the same page. Worked brilliantly for me. '
By the way if you are using jQuery 1.3.x or higher, you should modify the script a little as described in the disscussion here: http://instantlistfilter.codeplex.com/Thread/View.aspx?ThreadId=49123