Skip to main content
edited title
Link
Mark Cassidy
  • 25.4k
  • 7
  • 59
  • 117

Help with Solr/luceneContentSearch LINQ query syntax

edited tags
Link
Mark Cassidy
  • 25.4k
  • 7
  • 59
  • 117
Syntax highlighting and made the question part clearer
Source Link
Richard Seal
  • 20.8k
  • 5
  • 44
  • 79

Here is my scenario:

  • Bucket of sitecore items of a specific template
  • This template has a field tags(which is a treelist) where you can associate x items there. I'm building a query using lucene to retrieve all the items from the index that have the same tags as my current item. How can I do that?

My code is not 100% done because getting this relashionship is not working properly.

using (var context = ContentSearchManager.GetIndex(indexName).CreateSearchContext())
        {

            //Filters related articles
            var relatedSearchQuery =      context.GetQueryable<SearchResultItem>()
                    .Where( item => item.ItemId != currentArticle.Id.ToID() 
                            //HOW DO I MAKE THAT RELASHIONSHIP AS I CAN'T MAKE STANDARD LINQ QUERIES AT THIS POINT? 
using (var context = ContentSearchManager.GetIndex(indexName).CreateSearchContext())
{
    //Filters related articles
    var relatedSearchQuery = context.GetQueryable<SearchResultItem>()
        .Where( item => item.ItemId != currentArticle.Id.ToID() 

How do I make that relationship as I can't make standard Linq queries at this point?

Here is my scenario:

  • Bucket of sitecore items of a specific template
  • This template has a field tags(which is a treelist) where you can associate x items there. I'm building a query using lucene to retrieve all the items from the index that have the same tags as my current item. How can I do that?

My code is not 100% done because getting this relashionship is not working properly.

using (var context = ContentSearchManager.GetIndex(indexName).CreateSearchContext())
        {

            //Filters related articles
            var relatedSearchQuery =      context.GetQueryable<SearchResultItem>()
                    .Where( item => item.ItemId != currentArticle.Id.ToID() 
                            //HOW DO I MAKE THAT RELASHIONSHIP AS I CAN'T MAKE STANDARD LINQ QUERIES AT THIS POINT? 

Here is my scenario:

  • Bucket of sitecore items of a specific template
  • This template has a field tags(which is a treelist) where you can associate x items there. I'm building a query using lucene to retrieve all the items from the index that have the same tags as my current item. How can I do that?

My code is not 100% done because getting this relashionship is not working properly.

using (var context = ContentSearchManager.GetIndex(indexName).CreateSearchContext())
{
    //Filters related articles
    var relatedSearchQuery = context.GetQueryable<SearchResultItem>()
        .Where( item => item.ItemId != currentArticle.Id.ToID() 

How do I make that relationship as I can't make standard Linq queries at this point?

Source Link
Diego
  • 5.7k
  • 2
  • 28
  • 61
Loading