<?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: Missing and duplicate results on gis.content.search in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/missing-and-duplicate-results-on-gis-content/m-p/807925#M2355</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I got the exact same issue.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/253815"&gt;Carl Albury&lt;/A&gt;&amp;nbsp;did you find a solution in the meantime, since it is a while that you posted this question?‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Oct 2020 16:14:54 GMT</pubDate>
    <dc:creator>AndreasHolterman</dc:creator>
    <dc:date>2020-10-22T16:14:54Z</dc:date>
    <item>
      <title>Missing and duplicate results on gis.content.search</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/missing-and-duplicate-results-on-gis-content/m-p/807924#M2354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to do some content management via a jupyter notebook using the code:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;from arcgis.gis import GIS&lt;BR /&gt;gis = GIS("https://arcgis.com", "&amp;lt;USERNAME&amp;gt;", "&amp;lt;PASSWORD&amp;gt;")&lt;BR /&gt;search_result = gis.content.search(query="owner:&amp;lt;USERNAME&amp;gt;", item_type="Tile Package", max_items = 750)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which returns the correct number of tile packages, however when I loop through the results some packages are missing, others duplicated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I other words, instead of getting:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Tile_Package_a&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN&gt;Tile_Package_b&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN&gt;Tile_Package_c&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I get:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Tile_Package_a&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN&gt;Tile_Package_b&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN&gt;Tile_Package_b&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Tile_Package_c is there, I can find&amp;nbsp;it using gis.content.get(id) but not through content.search. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any suggestions?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Aug 2019 21:44:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/missing-and-duplicate-results-on-gis-content/m-p/807924#M2354</guid>
      <dc:creator>CarlAlbury</dc:creator>
      <dc:date>2019-08-19T21:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: Missing and duplicate results on gis.content.search</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/missing-and-duplicate-results-on-gis-content/m-p/807925#M2355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I got the exact same issue.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/253815"&gt;Carl Albury&lt;/A&gt;&amp;nbsp;did you find a solution in the meantime, since it is a while that you posted this question?‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Oct 2020 16:14:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/missing-and-duplicate-results-on-gis-content/m-p/807925#M2355</guid>
      <dc:creator>AndreasHolterman</dc:creator>
      <dc:date>2020-10-22T16:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: Missing and duplicate results on gis.content.search</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/missing-and-duplicate-results-on-gis-content/m-p/807926#M2356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/356763"&gt;Andreas Holterman&lt;/A&gt;, sorry for the slow reply. I did not get a solution to this issue. I had a convoluted work-around where I was able to get all of my itemid's for my tpks, which I put into a giant list and looped through that list using "gis.content.get(&lt;EM&gt;itemid&lt;/EM&gt;)" to make my changes (I was modifying metadata for each item). What I can't remember is how I got that comprehensive list of itemid's. I suspect I printed them repeatedly, then combined the lists and eliminated duplicates (in Excel) until I had a list of unique id's of the correct number.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry I don't have a better answer, if you figure anything out I would love to hear about it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Nov 2020 22:19:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/missing-and-duplicate-results-on-gis-content/m-p/807926#M2356</guid>
      <dc:creator>CarlAlbury</dc:creator>
      <dc:date>2020-11-05T22:19:30Z</dc:date>
    </item>
    <item>
      <title>Re: Missing and duplicate results on gis.content.search</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/missing-and-duplicate-results-on-gis-content/m-p/807927#M2357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you &lt;A href="https://community.esri.com/migrated-users/253815" target="_blank"&gt;Carl Albury&lt;/A&gt; for your reply. I have been looking into this issue a little bit deeper, and came to the conclusion that the amount of returned items always matched the expected outcome. It just inconsistently returned duplicate and missing items. My solution was to check for duplicate items in the returned list, and redo the entire search until I got&amp;nbsp;a list without duplicates. So far this has done the job:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;search_gis_layers&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
    gis_portal&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; Any&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
    query&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
    item_type&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
    max_items&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; int &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1000&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
    failures&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; int &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; List&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;Any&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="string token"&gt;"""Search layers in ArcGIS Online.
    :param gis_portal: Connection to ArcGIS Online portal
    :param query: the string to search for
    :param item_type: item type to search for
    :param max_items: the maximum numbers of items to return
    :param failures: the number of incomplete requests
    :return: list of items"""&lt;/SPAN&gt;
    item_search &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; gis_portal&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;content&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;search&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
        query&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; item_type&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;item_type&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; max_items&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;max_items
    &lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    search_result &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
    mission_failed &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;False&lt;/SPAN&gt;

    &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; item &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; item_search&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; item &lt;SPAN class="operator token"&gt;not&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; search_result&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
            search_result&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;append&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;item&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
            logging&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;error&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="string token"&gt;"{item} is already present in list search_result"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
            mission_failed &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;
            failures &lt;SPAN class="operator token"&gt;+=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;break&lt;/SPAN&gt;

    &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; mission_failed &lt;SPAN class="operator token"&gt;and&lt;/SPAN&gt; failures &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;10&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; search_gis_layers&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;gis_portal&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; query&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; item_type&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; max_items&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; failures&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;elif&lt;/SPAN&gt; mission_failed &lt;SPAN class="operator token"&gt;and&lt;/SPAN&gt; failures &lt;SPAN class="operator token"&gt;&amp;gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;10&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        sys&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;exit&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
            &lt;SPAN class="string token"&gt;"Mission failed. Tried 10 times, the returned layer list remained incomplete."&lt;/SPAN&gt;
        &lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; search_result‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:27:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/missing-and-duplicate-results-on-gis-content/m-p/807927#M2357</guid>
      <dc:creator>AndreasHolterman</dc:creator>
      <dc:date>2021-12-12T09:27:28Z</dc:date>
    </item>
  </channel>
</rss>

