Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I've got a Visual Studio (VS) solution with two VS Project (Project A comes with the Umbraco site and Project B is a just a normal MVC site.
Was wondering if there's a way I can read the the Examine Index (that will be available in Project A) within Project B?
Might need something that read the index with a directory.
Appreciate any help
In Umbraco project we have config folder, in this folder ExamineIndex.config file.
There are you can change folder of index files.
Be aware that recent versions of Umbraco keep a writelock open on the index for performance reasons. This means that the index cannot be read by other processes unless you touch the web.config.
Kindly see http://issues.umbraco.org/issue/U4-6321 for an explanation.
You could expose the Umbraco examine index data via webapi and in that webapi some querying. Then your non umbraco site can make calls to webapi in site a and get any data you require.
Looking for the same thing too. Any idea how do you do that?
See https://our.umbraco.org/documentation/Reference/WebApi/ then in your method you would add the querying code and take in some search parameters for the data you want. I would suggest you send back your own poco type list of the data rather than ISearchResult.
Any sample codes? kind of confuse a little
Read the first link i sent regarding how to create webapi https://our.umbraco.org/documentation/Reference/WebApi/ with umbraco then read examine docs see https://our.umbraco.org/Documentation/Reference/Searching/Examine/index which details how you query. I have some code not included all of it but
Web api bit
public ApiSearchResponse SearchMaleTalent([FromUri] ModelSearch searchParams)
return SearchTalent(searchParams, Constants.MediaTypes.TalentMale);
private ApiSearchResponse SearchTalent(ModelSearch searchParams, string talentGenderAlias)
var criteria = SearchHelper.GetSearchDictionary(searchParams.ToDictionary(), talentGenderAlias);
var talents = _boardService.SearchTalent(criteria, out generatedQuery);
var searchResponse = new ApiSearchResponse();
searchResponse.ResultCount = talents.Items.Count;
searchResponse.Board = talents;
searchResponse.GeneratedQuery = generatedQuery;
searchResponse.Success = true;
The board service has some code that looks like
var externalCriteria = _externalSearcher.CreateSearchCriteria(IndexTypes.Content);
IBooleanOperation query = externalCriteria.OrderBy(Constants.DocTypesProperties.Talent.FirstName);
query = externalCriteria.NodeTypeAlias(fields[Constants.Examine.NodeTypeAlias]);
fields.Remove(Constants.Examine.NodeTypeAlias); //dont want the nodetypealias twice in search query
generatedQuery = externalCriteria.ToString(); //just here for debugging purposes
var results = _externalSearcher.Search(query.Compile());
Basically there are 2 pieces to this puzzle the first bit is the webapi, look at the docs and just create simple webapi that returns some mock list of objects. Next create your search class using examine see the docs and perform search and return results.
Thanks Ismail, will try it out
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted