Xwiki page text not included in solr search results

If I search for a term like “all cats are green” in xwiki and the exact term is used on a xwiki page, I still get zero results. It looks like, only tags, attachments, page title are really indexed. Is this the case?
My only change to the SolrSearchConfig is “‘filterQuery’: [’-space_exact:Sandbox’,’-space_exact:XWiki’,‘hidden:false’],”

Can someone give me a hint?

Hello @sbernhard,

I tried to insert all cats are green in various places (title, new page, in the middle of the content of an existing page) in a fresh 14.9-SNAPSHOT wiki and searching for all cats are green returns the expected pages.

A few questions:

  • What version of XWiki are you using?
  • Did you wait for the indexation to be completed before running the search? You can check the queue size by going into the Search → Search section of the administration.

I tried with your config as well, and got the same results. Did you for single quotes (instead of ') in SolrSearchConfig or is it just a copy and paste issue?
You see a Failed to execute the [velocity] macro [...] error message when visiting the page if that’s the case.

Hope that helps.

The used version is 12.10.10.
Indexing finished hours ago.

complete config is:

{{velocity output="false"}}
#set ($supportedLocales = $xwiki.availableLocales)
{{/velocity}}

{{velocity output="false"}}
#set ($__defaultSolrConfig = {
  'queryFields': {
    'DOCUMENT': 'title^10.0 name^10.0
                 doccontent^2.0
                 objcontent^0.4 filename^0.4 attcontent^0.4 doccontentraw^0.4
                 author_display^0.08 creator_display^0.08
                 comment^0.016 attauthor_display^0.016 spaces^0.016',
    'ATTACHMENT': 'filename^5.0 attcontent attauthor_display^0.2',
    'OBJECT': 'objcontent',
    'OBJECT_PROPERTY': 'propertyvalue'
  },
  'phraseFields': {
    'DOCUMENT': "#expandField('title' '^400.0')
                 #expandField('doccontent' '^80.0')
                 filename^90.0 #expandField('attcontent' '^70.0')
                 comment^50.0
                 author_display^40.0 creator_display^40.0 attauthor_display^20.0",
    'ATTACHMENT': "filename^90.0 #expandField('attcontent' '^70.0') attauthor_display^40.0",
    'OBJECT': 'objcontent^10.0',
    'OBJECT_PROPERTY': 'propertyvalue^10.0',
    ''        : "#expandField('title' '^400.0')
                 #expandField('doccontent' '^80.0')
                 filename^90.0 #expandField('attcontent' '^70.0')
                 author_display^40.0 creator_display^40.0
                 comment^50.0 attauthor_display^20.0
                 objcontent^10.0 propertyvalue^10.0"
  },
  'bigramPhraseFields': {
    'DOCUMENT': "#expandField('title' '^200.0')
                 #expandField('doccontent' '^40.0')
                 filename^45.0 #expandField('attcontent' '^35.0')
                 comment^25.0 
                 author_display^20.0 creator_display^20.0 attauthor_display^10.0",
    'ATTACHMENT': "filename^45.0 #expandField('attcontent' '^35.0') attauthor_display^20.0",
    'OBJECT': 'objcontent^5.0',
    'OBJECT_PROPERTY': 'propertyvalue^5.0',
    ''        : "#expandField('title' '^200.0')
                 #expandField('doccontent' '^40.0')
                 filename^45.0 #expandField('attcontent' '^35.0')
                 author_display^20.0 creator_display^20.0
                 comment^25.0 attauthor_display^10.0
                 objcontent^5.0 propertyvalue^5.0"
  },
  'trigramPhraseFields': {
    'DOCUMENT': "#expandField('title' '^300.0')
                 #expandField('doccontent' '^60.0')
                 filename^67.5 #expandField('attcontent' '^52.5')
                 comment^37.5 
                 author_display^30.0 creator_display^30.0 attauthor_display^15.0",
    'ATTACHMENT': "filename^67.5 #expandField('attcontent' '^52.5') attauthor_display^30.0",
    'OBJECT': 'objcontent^7.5',
    'OBJECT_PROPERTY': 'propertyvalue^7.5',
    ''        : "#expandField('title' '^300.0')
                 #expandField('doccontent' '^60.0')
                 filename^67.5 #expandField('attcontent' '^52.5')
                 author_display^30.0 creator_display^30.0
                 comment^37.5 attauthor_display^15.0
                 objcontent^7.5 propertyvalue^7.5"
  },
  'phraseFieldSlop': '15',
  'bigramPhraseFieldSlop': '5',
  'trigramPhraseFieldSlop': '10',
  'tieBreaker': '0.1',
  'minShouldMatch': '2',
  'sortFields': {
    'DOCUMENT': {
      'score': 'desc',
      'title_sort': 'asc',
      'date': 'desc',
      'author_display_sort': 'asc'
    },
    'ATTACHMENT': {
      'score': 'desc',
      'filename_sort': 'asc',
      'attsize_sort': 'asc',
      'attdate_sort': 'desc',
      'attauthor_display_sort': 'asc'
    }
  },
  'filterQuery': ['-space_exact:Sandbox','-space_exact:XWiki','hidden:false'],
  'facetFields': ['type', 'wiki', 'space_facet', 'locale', 'author', 'creator', 'date',
    'creationdate', 'class', 'mimetype', 'attauthor', 'attdate', 'attsize'],
  'facetQuery': {
    'type': 'DOCUMENT',
    'locale': ["$xcontext.locale", '']
  },
  'facetEnabled': true,
  'facetDisplayers': {
    'type': 'Main.SolrTypeFacet',
    'wiki': 'Main.SolrWikiFacet',
    'space_facet': 'Main.SolrSpaceFacet',
    'locale': 'Main.SolrLocaleFacet',
    'author': 'Main.SolrUserFacet',
    'creator': 'Main.SolrUserFacet',
    'attauthor': 'Main.SolrUserFacet',
    'date': 'Main.SolrDateFacet',
    'creationdate': 'Main.SolrDateFacet',
    'attdate': 'Main.SolrDateFacet',
    'class': 'Main.SolrClassFacet',
    'attsize': 'Main.SolrFileSizeFacet',
    'mimetype': 'Main.SolrMediaTypeFacet'
  },
  'facetDisplayersByPropertyType': {
    'Date': 'Main.SolrDateFacet',
    'Users': 'Main.SolrUserFacet',
    'Groups': 'Main.SolrUserFacet'
  },
  'facetPaginationStep': 5,
  'facet': {
    'mediaType': {
      'categories': {
        'text': ['text/', 'application/xml', 'application/javascript', 'application/ecmascript',
          'application/json', 'application/x-sh', '+xml'],
        'image': ['image/'],
        'office': ['application/pdf', 'application/postscript', 'application/msword', 'application/vnd.ms-',
          'application/vnd.oasis.opendocument.', 'application/vnd.openxmlformats-officedocument.'],
        'archive': ['application/zip', 'application/x-gzip', 'application/x-bzip', 'application/x-tar',
          'application/x-gtar', 'application/vnd.xara', '-archive', '-compressed', '-package', '+zip'],
        'audio': ['audio/'],
        'video': ['video/'],
        'font': ['application/font-', 'application/x-font-']
      },
      'subcategories': {
        'office': {
          'word': ['application/msword', 'application/vnd.ms-word.', 'application/vnd.oasis.opendocument.text',
            'application/vnd.openxmlformats-officedocument.word'],
          'presentation': ['application/vnd.ms-powerpoint', 'application/vnd.oasis.opendocument.presentation',
            'application/vnd.openxmlformats-officedocument.presentation'],
          'spreadsheet': ['application/vnd.ms-excel', 'application/vnd.oasis.opendocument.spreadsheet',
            'application/vnd.openxmlformats-officedocument.spreadsheet']
        }
      }
    },
    'fileSize': {
      'intervals': [
        {
          'id': 'tiny',
          'end': 10240
        }, {
          'id': 'small',
          'start': 10240,
          'end': 512000
        }, {
          'id': 'medium',
          'start': 512000,
          'end': 5242880
        }, {
          'id': 'large',
          'start': 5242880
        }
      ]
    }
  },
  'wikisSearchableFromMainWiki': $wikisSearchableFromMainWiki,
  'highlightEnabled' : true
})

#if (!$xcontext.isMainWiki() || !$xwiki.hasSubWikis())
  ## Subwikis search by default in their content only so it doesn't make sense to display the wiki facet.
  ## It also doesn't make sense to display the wiki facet if there is a single wiki.
  #set ($discard = $__defaultSolrConfig.facetFields.remove('wiki'))
#end

#if ($solrConfig)
  ## Merge the provided configuration with the default configuration.
  #set ($discard = $__defaultSolrConfig.putAll($solrConfig))
#end
#set ($solrConfig = $__defaultSolrConfig)

#macro (expandField $fieldName $fieldBoost)
  ${fieldName}__${fieldBoost} ##
  #foreach ($locale in $supportedLocales)
    ${fieldName}_${locale}${fieldBoost} ##
  #end
#end
{{/velocity}}

Is there another config which affects the solr search engine indexer or how the search string is created which will then be send to solr for the search itself?

In which log file I need to look to get more info?

Hi @sbernhard.

Maybe this is related: Search suggestion only showing attachments, search only documents - #5 by Simpel?

Regards, Simpel

I tried this. Thanks @Simpel
In Global Administration → Localization “de_DE” is set for supported language and for default language.
I choose the wiki page containing “all cats are green” and then had a look at the db:
xwiki_language= “”, xwiki_default_language=“de_DE”

Unfortunately, I was not able to find this page with the solr search.

Can you try setting your wiki to “de” create a new page and write your search strings inside and try searching again?
What you can try too change wiki to multilanguage go to the page including your search string, go to information and change the pages language to “de”. Then search for it.

That was a perfect tipp. Thanks. now it works like a charm!

1 Like