<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: gis.ContentManager.search will not do exact match. in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1091533#M6523</link>
    <description>&lt;P&gt;Brian, I have moved your question to the ArcGIS for Python questions community since the python question is less python and more api related&lt;/P&gt;</description>
    <pubDate>Tue, 24 Aug 2021 01:50:23 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2021-08-24T01:50:23Z</dc:date>
    <item>
      <title>gis.ContentManager.search will not do exact match.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1091515#M6522</link>
      <description>&lt;P&gt;Running this code in Jupyter notebook gives this output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
from config import Config
portal = GIS(Config.PORTAL_URL, Config.PORTAL_USER, Config.PORTAL_PASSWORD)
print("Logged in as " + str(portal.properties.user.username))
portal.content.search("title:\"Unlabeled Vector Tile Layer\"")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="output-inner-container foreground output-element"&gt;&lt;BLOCKQUOTE&gt;&lt;DIV class="rendered-output"&gt;&lt;SPAN class="output-stream"&gt;&lt;SPAN class=""&gt;Logged in as &lt;A href="mailto:bwilson@CLATSOP" target="_blank" rel="noopener"&gt;bwilson@CLATSOP&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="rendered-output"&gt;&lt;SPAN&gt;[&amp;lt;Item title:"Package for Unlabeled Vector Tile Layer" type:Vector Tile Package owner:bwilson@CLATSOP&amp;gt;, &lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;Item title:"Unlabeled Vector Tile Layer" type:Vector Tile Layer owner:bwilson@CLATSOP&amp;gt;]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;/DIV&gt;&lt;P&gt;How can I force an exact match?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I looked in&amp;nbsp;&lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/search-reference.htm" target="_blank" rel="noopener"&gt;Search Reference&lt;/A&gt;&amp;nbsp;and&amp;nbsp;&lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#contentmanager" target="_self"&gt;gis.ContentManager&lt;/A&gt;&amp;nbsp;but I can't see a way to do this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 00:04:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1091515#M6522</guid>
      <dc:creator>Brian_Wilson</dc:creator>
      <dc:date>2021-08-24T00:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: gis.ContentManager.search will not do exact match.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1091533#M6523</link>
      <description>&lt;P&gt;Brian, I have moved your question to the ArcGIS for Python questions community since the python question is less python and more api related&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 01:50:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1091533#M6523</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-08-24T01:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: gis.ContentManager.search will not do exact match.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1091579#M6525</link>
      <description>&lt;P&gt;Hi there&lt;/P&gt;&lt;P&gt;Is there any reason why you don't want to use the item id? This will be an exact match.&lt;/P&gt;&lt;P&gt;item =&amp;nbsp; portal.content.get('itemid')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 04:40:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1091579#M6525</guid>
      <dc:creator>PeterMilenkovic</dc:creator>
      <dc:date>2021-08-24T04:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: gis.ContentManager.search will not do exact match.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1091738#M6532</link>
      <description>&lt;P&gt;My goal is to create tools that other people can and will use.&lt;/P&gt;&lt;P&gt;If I tell my co-workers they will need to remember to type in&amp;nbsp; "&lt;SPAN&gt;814cdd2d372f47ac88b9d2996567368e" instead of "Vector Tile Layer" they will simply not use the tool.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;In fact I am already using "get" method because it works but that only works for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 15:12:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1091738#M6532</guid>
      <dc:creator>Brian_Wilson</dc:creator>
      <dc:date>2021-08-24T15:12:09Z</dc:date>
    </item>
    <item>
      <title>Re: gis.ContentManager.search will not do exact match.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1091745#M6533</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I'm used to using SQL-like queries all over in Esri APIs, so it's a mystery why queries with this tool are so useless. I assume that it was an intern's summer project and no one competent ever checked it, it fell between the cracks.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Next summer maybe they will get an intern who has finished learning about SQL&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;or even just wildcard matches and they can add a more useful method to the ContentManager.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 15:21:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1091745#M6533</guid>
      <dc:creator>Brian_Wilson</dc:creator>
      <dc:date>2021-08-24T15:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: gis.ContentManager.search will not do exact match.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1091748#M6534</link>
      <description>&lt;P&gt;Thanks Dan. I'm thinking about adding ...thinking about retiring... to my posts explain my surliness.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 15:23:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1091748#M6534</guid>
      <dc:creator>Brian_Wilson</dc:creator>
      <dc:date>2021-08-24T15:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: gis.ContentManager.search will not do exact match.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1091797#M6535</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/3374"&gt;@JoeBorgione&lt;/a&gt;&amp;nbsp;has laid claimsies to "Can't Wait to Retire" so I think "&lt;SPAN&gt;thinking about retiring" is still open for now &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 16:51:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1091797#M6535</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-08-24T16:51:29Z</dc:date>
    </item>
    <item>
      <title>Re: gis.ContentManager.search will not do exact match.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1092033#M6538</link>
      <description>&lt;P&gt;Ok,&lt;/P&gt;&lt;P&gt;You can specify the type of item? You have the same text in the title of your vector tile package/layer.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 22:59:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1092033#M6538</guid>
      <dc:creator>PeterMilenkovic</dc:creator>
      <dc:date>2021-08-24T22:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: gis.ContentManager.search will not do exact match.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1092050#M6539</link>
      <description>&lt;P&gt;Your suggestions are very good, but I still want to be able to do exact matching. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;One of my other cases for example requires matching a layer named "Clatsop County" and we have probably 30 other layers that have "Clatsop County" somewhere in their names.&lt;/P&gt;&lt;P&gt;Ultimately I think I'll teach people how to find the ID, it is a pain but it removes all ambiguity.&lt;/P&gt;&lt;P&gt;Esri needs more than "Accept as Solution", I'd like to mark your answer as "Accept as Workaround" &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 23:36:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1092050#M6539</guid>
      <dc:creator>Brian_Wilson</dc:creator>
      <dc:date>2021-08-24T23:36:48Z</dc:date>
    </item>
    <item>
      <title>Re: gis.ContentManager.search will not do exact match.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1092053#M6540</link>
      <description>&lt;P&gt;Ah, that would be annoying.&lt;/P&gt;&lt;P&gt;Found this re searching, the overview explains why exact matching is not ideal.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/search-reference.htm" target="_blank"&gt;https://developers.arcgis.com/rest/users-groups-and-items/search-reference.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 23:47:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1092053#M6540</guid>
      <dc:creator>PeterMilenkovic</dc:creator>
      <dc:date>2021-08-24T23:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: gis.ContentManager.search will not do exact match.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1092247#M6542</link>
      <description>&lt;P&gt;That would explain the documentation, the text for "filter" bled through to the python docs even though it's not implemented. It says&lt;/P&gt;&lt;P&gt;"As a general rule, filter (i.e. defined in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="usertext"&gt;filter&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;parameter) should be used instead of query&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;for binary yes/no searches.&lt;/LI&gt;&lt;LI&gt;for queries on exact values."&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;So when I am bored later this afternoon I will look at using the REST interface instead of the API and see if it works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Aug 2021 15:13:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1092247#M6542</guid>
      <dc:creator>Brian_Wilson</dc:creator>
      <dc:date>2021-08-25T15:13:38Z</dc:date>
    </item>
    <item>
      <title>Re: gis.ContentManager.search will not do exact match.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1093191#M6554</link>
      <description>&lt;P&gt;Today when revisiting this issue I found this&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-online-ideas/exact-match-option-for-gis-content-search/idi-p/930617" target="_blank"&gt;https://community.esri.com/t5/arcgis-online-ideas/exact-match-option-for-gis-content-search/idi-p/930617&lt;/A&gt;&lt;/P&gt;&lt;P&gt;and there's a mention that Esri closed the "enhancement request" with basically "we're not going to do this because it would be hard for us." &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Aug 2021 16:31:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1093191#M6554</guid>
      <dc:creator>Brian_Wilson</dc:creator>
      <dc:date>2021-08-27T16:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: gis.ContentManager.search will not do exact match.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1093208#M6555</link>
      <description>&lt;P&gt;It's pretty easy, a REST query works like this to give me an exact match. It was so easy that I must be missing something critical &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Here is a sample query.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://myserver/sharing/rest/search?f=json&amp;amp;q=&amp;amp;filter=title" target="_blank"&gt;https://myserver/sharing/rest/search?f=json&amp;amp;q=&amp;amp;filter=title&lt;/A&gt;:"Vector Tile Layer"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It returns exactly one match.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Note that I had to send an empty query for the call to work "q="&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I get the fuzzy matching when I move the query from filter to q, then I get 4 matches.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://myserver/portal/sharing/rest/search?f=json&amp;amp;q=title" target="_blank"&gt;https://myserver/portal/sharing/rest/search?f=json&amp;amp;q=title&lt;/A&gt;:"Vector Tile Layer"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;title="Vector Tile Layer",&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;title="Package for Unlabeled Vector Tile Layer", and so on.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Aug 2021 16:58:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1093208#M6555</guid>
      <dc:creator>Brian_Wilson</dc:creator>
      <dc:date>2021-08-27T16:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: gis.ContentManager.search will not do exact match.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1093261#M6556</link>
      <description>&lt;P&gt;This took a little digging around in the code but I got exact match to work, now I can wrap it in a "get id" function. Here is an example using fuzzy and exact searches.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from config import Config
from arcgis.gis import GIS
portal = GIS(Config.PORTAL_URL, Config.PORTAL_USER, Config.PORTAL_PASSWORD)
print("Logged in as " + str(portal.properties.user.username))
q='title:"Vector Tile Layer"'
fuzzy = portal.content.search(query=q)
connection = portal._con # I understand, this is private and could change
params = {'q': '', 'filter': q}
exact = connection.post(Config.PORTAL_URL + '/sharing/rest/search', params)
print("Fuzzy matches:", len(fuzzy))
print("Exact matches: %d ID: %s" % (res['total'], res['results'][0]['id']))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output looks like this:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Logged in as bwilson@CLATSOP
Fuzzy matches: 4
Exact matches: 1 ID: b69b15dbf53c459a9e709bde764aaefa&lt;/LI-CODE&gt;&lt;P&gt;All the same options that work for the search and advanced_search methods can be passed in the "params" dictionary. If Esri would simply put an additional "filter" argument into those methods, they would work since all this code does is go directly to the post() call that's buried in those methods.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Aug 2021 19:45:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1093261#M6556</guid>
      <dc:creator>Brian_Wilson</dc:creator>
      <dc:date>2021-08-27T19:45:40Z</dc:date>
    </item>
    <item>
      <title>Re: gis.ContentManager.search will not do exact match.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1093845#M6561</link>
      <description>&lt;P&gt;Well done, that's really neat.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 22:53:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/gis-contentmanager-search-will-not-do-exact-match/m-p/1093845#M6561</guid>
      <dc:creator>PeterMilenkovic</dc:creator>
      <dc:date>2021-08-30T22:53:19Z</dc:date>
    </item>
  </channel>
</rss>

