SOLVED

Inconsistant results from web part KQL query

%3CLINGO-SUB%20id%3D%22lingo-sub-25817%22%20slang%3D%22en-US%22%3EInconsistant%20results%20from%20web%20part%20KQL%20query%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-25817%22%20slang%3D%22en-US%22%3E%3CP%3EHi.%20I%20am%20testing%20the%20use%20of%20KQL%20in%20webparts.%20The%20site%20collection%20has%20separate%20sites%2C%20libraries%20in%20each%20site%20and%20some%20documents%20in%20OneDrive%20for%20individual%20users.%20I%20am%20populating%20the%20file%2Fdocument%20'title'%20property%20with%20structured%20text.%20The%20title%20field%20contains%20indicators%20of%20document%20type%20and%20service%20area.%20This%20would%20appear%20something%20like%20%22title%3DPolicy%3A%20Property%20Services%22.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20test%20library%20contains%2023%20documents%20each%20with%20a%20populated%20title%20field.%3C%2FP%3E%3CP%3EI%20have%20two%20web%20part%20queries.%20The%20first%20returns%20any%20documents%20which%20do%20not%20have%20the%20correctly%20structured%20text%20in%20the%20title%20-%20(FileExtension%3Adoc%20OR%20FileExtension%3Adocx%20OR%20FileExtension%3Axls%20OR%20FileExtension%3Axlsx%20OR%20FileExtension%3A'ppt'%20OR%20FileExtension%3A'pptx'%20OR%20FileExtension%3A'pdf')%20(IsDocument%3A%22True%22%20OR%20contentclass%3A%22STS_ListItem%22)%20AND%20-title%3A'policy'%3A%20AND%20-title%3A'procedure'%3A%20AND%20-title%3Aguidance%3A%20AND%20-title%3Astrategy%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20second%20query%20returns%20results%20for%20any%20document%20where%20title%20%3D%20policy%3A'property'%20services%20-%20(FileExtension%3Adoc%20OR%20FileExtension%3Adocx%20OR%20FileExtension%3Axls%20OR%20FileExtension%3Axlsx%20OR%20FileExtension%3A'ppt'%20OR%20FileExtension%3A'pptx'%20OR%20FileExtension%3A'pdf')%20(IsDocument%3A%22True%22%20OR%20contentclass%3A%22STS_ListItem%22)%20Title%3A%3Dpolicy%3A%20property%20services%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3ENOTE%3A%20Please%20excuse%20the%20extra%20inverted%20commas%20above.%20This%20stupid%20interface%20wants%20to%20interpret%20colon%20p%20as%20a%20smiley%20face.%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20works%20well%20for%2022%20of%20the%2023%20documents%20I'm%20searching%20for.%20The%20last%20one%20is%26nbsp%3Ba%20newly%20created%20document%20which%20is%20consistantly%20returned%20by%20query%201%20even%20though%20it%20has%20%22policy%3A%22%20in%20the%20title%20field%20and%20never%20returned%20by%20query%202%20even%20though%20the%20title%20is%20populated%20with%20%22policy%3A%20property%20services%22.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20tried%20re-index%20of%20the%20collection%20and%20of%20the%20library%2C%20I%20have%20also%20deleted%20the%20document%20from%20the%20library%20and%20reimported%20it.%20Once%20deleted%20the%20document%20disapears%20from%20search%20results%20after%20around%2010%20minutes.%20Once%20reimported%20it%20reappears%20in%20search%20results%20after%20around%2010%20minutes%2C%20but%20still%20wrong.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20suggestions%20gratefully%20recieved.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EChris%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-25817%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-26061%22%20slang%3D%22en-US%22%3ERe%3A%20Inconsistant%20results%20from%20web%20part%20KQL%20query%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-26061%22%20slang%3D%22en-US%22%3E%3CBLOCKQUOTE%3E%3CHR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F34%22%20target%3D%22_blank%22%3E%40Mikael%20Svenson%3C%2FA%3E%20wrote%3A%3CBR%20%2F%3E%3CP%3EHere's%20my%20recommended%20list%20to%26nbsp%3Bthe%20order%20of%20crawled%20properties%20for%20the%20Title%20managed%20property%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3ETermTitle%3C%2FLI%3E%3CLI%3Eows_BaseName%3C%2FLI%3E%3CLI%3EOffice%3A2%3C%2FLI%3E%3CLI%3ETitle%3C%2FLI%3E%3C%2FUL%3E%3CP%3Eand%20move%20MetadataExtractorTitle%20to%20the%20very%20bottom.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere's%20an%20article%20explaining%20it%20all%20and%20you%20can%20change%20the%20order%20to%20suit%20your%20needs%3A%20%3CA%20href%3D%22https%3A%2F%2Fblogs.msdn.microsoft.com%2Fspses%2F2013%2F10%2F30%2Fshow-more-relevant-titles-in-search-results-in-sharepoint-2013-plus-some-other-improvements%2F%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fblogs.msdn.microsoft.com%2Fspses%2F2013%2F10%2F30%2Fshow-more-relevant-titles-in-search-results-in-sharepoint-2013-plus-some-other-improvements%2F%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERemember%20to%20re-index%20after%20you%20change%20mapping%20order.%3C%2FP%3E%3CHR%20%2F%3E%3C%2FBLOCKQUOTE%3E%3CP%3EThanks%20Mikael.%20That%20was%20exactly%20it.%20Problem%20now%20resolved.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EChris%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-26040%22%20slang%3D%22en-US%22%3ERe%3A%20Inconsistant%20results%20from%20web%20part%20KQL%20query%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-26040%22%20slang%3D%22en-US%22%3E%3CP%3EHere's%20my%20recommended%20list%20to%26nbsp%3Bthe%20order%20of%20crawled%20properties%20for%20the%20Title%20managed%20property%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3ETermTitle%3C%2FLI%3E%3CLI%3Eows_BaseName%3C%2FLI%3E%3CLI%3EOffice%3A2%3C%2FLI%3E%3CLI%3ETitle%3C%2FLI%3E%3C%2FUL%3E%3CP%3Eand%20move%20MetadataExtractorTitle%20to%20the%20very%20bottom.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere's%20an%20article%20explaining%20it%20all%20and%20you%20can%20change%20the%20order%20to%20suit%20your%20needs%3A%20%3CA%20href%3D%22https%3A%2F%2Fblogs.msdn.microsoft.com%2Fspses%2F2013%2F10%2F30%2Fshow-more-relevant-titles-in-search-results-in-sharepoint-2013-plus-some-other-improvements%2F%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fblogs.msdn.microsoft.com%2Fspses%2F2013%2F10%2F30%2Fshow-more-relevant-titles-in-search-results-in-sharepoint-2013-plus-some-other-improvements%2F%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERemember%20to%20re-index%20after%20you%20change%20mapping%20order.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-26034%22%20slang%3D%22en-US%22%3ERe%3A%20Inconsistant%20results%20from%20web%20part%20KQL%20query%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-26034%22%20slang%3D%22en-US%22%3E%3CP%3ECould%20it%20be%20you%20want%20the%20fileleafref%20instead%20of%20the%20title%3F%20as%20title%20can%20also%20be%20a%20docproperty%20which%20is%20the%20first%20thing%20Search%20finds%20in%20your%20document%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-25980%22%20slang%3D%22en-US%22%3ERe%3A%20Inconsistant%20results%20from%20web%20part%20KQL%20query%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-25980%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20guys.%20I'll%20download%20it%20and%20give%20it%20a%20try%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-25864%22%20slang%3D%22en-US%22%3ERe%3A%20Inconsistant%20results%20from%20web%20part%20KQL%20query%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-25864%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20Search%20Query%20Tool%20can%20be%20useful%20for%20troubleshooting%20problems%20like%20this%2C%20%3CA%20href%3D%22http%3A%2F%2Fsp2013searchtool.codeplex.com%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fsp2013searchtool.codeplex.com%2F%3C%2FA%3E.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F34%22%20target%3D%22_blank%22%3E%40Mikael%20Svenson%3C%2FA%3E%26nbsp%3Bmay%20be%20able%20to%20help%20also%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-25857%22%20slang%3D%22en-US%22%3ERe%3A%20Inconsistant%20results%20from%20web%20part%20KQL%20query%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-25857%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%20can%20you%20use%20the%20%3CA%20href%3D%22https%3A%2F%2Fsp2013searchtool.codeplex.com%2F%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3ESP2013%20query%20tool%3C%2FA%3E%20and%26nbsp%3Binspect%20what%20the%20Title%20value%20is%20for%20that%20one%20document%3F%26nbsp%3BIt%20could%20be%20the%20automatic%20extracted%20title%20which%26nbsp%3Btrips%20you%20up%20as%20the%20default%20mapping%20of%20crawled%20properties%20for%20the%20Title%20managed%20property%20is%20not%20a%20good%20one%20imo.%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hi. I am testing the use of KQL in webparts. The site collection has separate sites, libraries in each site and some documents in OneDrive for individual users. I am populating the file/document 'title' property with structured text. The title field contains indicators of document type and service area. This would appear something like "title=Policy: Property Services".

 

 

The test library contains 23 documents each with a populated title field.

I have two web part queries. The first returns any documents which do not have the correctly structured text in the title - (FileExtension:doc OR FileExtension:docx OR FileExtension:xls OR FileExtension:xlsx OR FileExtension:'ppt' OR FileExtension:'pptx' OR FileExtension:'pdf') (IsDocument:"True" OR contentclass:"STS_ListItem") AND -title:'policy': AND -title:'procedure': AND -title:guidance: AND -title:strategy: 

 

The second query returns results for any document where title = policy:'property' services - (FileExtension:doc OR FileExtension:docx OR FileExtension:xls OR FileExtension:xlsx OR FileExtension:'ppt' OR FileExtension:'pptx' OR FileExtension:'pdf') (IsDocument:"True" OR contentclass:"STS_ListItem") Title:=policy: property services 

NOTE: Please excuse the extra inverted commas above. This stupid interface wants to interpret colon p as a smiley face.

 

This works well for 22 of the 23 documents I'm searching for. The last one is a newly created document which is consistantly returned by query 1 even though it has "policy:" in the title field and never returned by query 2 even though the title is populated with "policy: property services".

 

I have tried re-index of the collection and of the library, I have also deleted the document from the library and reimported it. Once deleted the document disapears from search results after around 10 minutes. Once reimported it reappears in search results after around 10 minutes, but still wrong.

 

Any suggestions gratefully recieved.

 

Chris

6 Replies
Best Response confirmed by Chris Watkins (New Contributor)
Solution

Hi, can you use the SP2013 query tool and inspect what the Title value is for that one document? It could be the automatic extracted title which trips you up as the default mapping of crawled properties for the Title managed property is not a good one imo.

The Search Query Tool can be useful for troubleshooting problems like this, http://sp2013searchtool.codeplex.com/.

 

@Mikael Svenson may be able to help also

Thanks guys. I'll download it and give it a try

Could it be you want the fileleafref instead of the title? as title can also be a docproperty which is the first thing Search finds in your document

Here's my recommended list to the order of crawled properties for the Title managed property:

 

  • TermTitle
  • ows_BaseName
  • Office:2
  • Title

and move MetadataExtractorTitle to the very bottom.

 

Here's an article explaining it all and you can change the order to suit your needs: https://blogs.msdn.microsoft.com/spses/2013/10/30/show-more-relevant-titles-in-search-results-in-sha...

 

Remember to re-index after you change mapping order.


@Mikael Svenson wrote:

Here's my recommended list to the order of crawled properties for the Title managed property:

 

  • TermTitle
  • ows_BaseName
  • Office:2
  • Title

and move MetadataExtractorTitle to the very bottom.

 

Here's an article explaining it all and you can change the order to suit your needs: https://blogs.msdn.microsoft.com/spses/2013/10/30/show-more-relevant-titles-in-search-results-in-sha...

 

Remember to re-index after you change mapping order.


Thanks Mikael. That was exactly it. Problem now resolved.

 

Chris