Forum Discussion

Kiril Iliev's avatar
Kiril Iliev
Brass Contributor
Nov 28, 2017

Filter by Item Version in KQL

I was looking for a crawled property for the list item / document version - stumbled on a few such as _Version, Version, Version0, ows_DocVersion. I have mapped them to the tenant's RefineableDecimal00.

 

Of course, I have re-indexed the site collection.

 

However, when making a search query for the property, it returns an empty value.

 

For example, here is a test KQL I am using in the Chrome SP Editor -> PnP JS Console:

import pnp, { SearchQuery, SearchResults } from "pnp";

pnp.sp.search(<SearchQuery>{
            Querytext: "Path:\"https://tenant.sharepoint.com/sites/Site1/Library1\" AND Title:\"My Item's Title\"",
            RowLimit: 16,
            SelectProperties: ["Title", "RefinableDecimal00", "Path"],
			SortList: [{
				Property: 'Created',
				Direction: 1
			}]
        }).then((response) => { console.log(response.PrimarySearchResults) })

Has anyone found a way to query for the list item version?

  • Posting our solution as somebody else might find it useful:

     

    1. We mapped the UI Version property (ows_q_TEXT__UIVersionString) to one of the Refinable Decimals

    2. We have given the refinable decimal an alias (SharePointVersion) in our case.

     

    So we were able to sort, and filter via a KQL the results, i.e. SharePointVersion>=2.1 was giving us items with version greater than or equal to 2.1 - it seems that SharePoint have successfully managed to parse the decimal value into the decimal property.

  • Kiril Iliev's avatar
    Kiril Iliev
    Brass Contributor

    Posting our solution as somebody else might find it useful:

     

    1. We mapped the UI Version property (ows_q_TEXT__UIVersionString) to one of the Refinable Decimals

    2. We have given the refinable decimal an alias (SharePointVersion) in our case.

     

    So we were able to sort, and filter via a KQL the results, i.e. SharePointVersion>=2.1 was giving us items with version greater than or equal to 2.1 - it seems that SharePoint have successfully managed to parse the decimal value into the decimal property.

Resources