€cdocutils.nodes document q)q}q(U nametypesq}q(Xadding documents to the indexqNX,ordering search results and rank expressionsqNX+viewing and adjusting stemming for a domainqNXcreating a connectionq NXhereq ˆXsetting access policiesq NXcreating a domainq NX cloudsearchq ˆXsearching documentsqNXdeleting documentsqNX,viewing and adjusting stopwords for a domainqNXcreating index fieldsqNX/an introduction to boto's cloudsearch interfaceqNuUsubstitution_defsq}qUparse_messagesq]qcdocutils.nodes system_message q)q}q(U rawsourceqUUparentqcdocutils.nodes section q)q}q(hUU referencedqKhh)q }q!(hUhhUsourceq"XE/Users/kyleknap/Documents/GitHub/boto/docs/source/cloudsearch_tut.rstq#Utagnameq$Usectionq%U attributesq&}q'(Udupnamesq(]Uclassesq)]Ubackrefsq*]Uidsq+]q,U/an-introduction-to-boto-s-cloudsearch-interfaceq-aUnamesq.]q/hauUlineq0KUdocumentq1hUchildrenq2]q3(cdocutils.nodes title q4)q5}q6(hX/An Introduction to boto's Cloudsearch interfaceq7hh h"h#h$Utitleq8h&}q9(h(]h)]h*]h+]h.]uh0Kh1hh2]q:cdocutils.nodes Text q;X/An Introduction to boto's Cloudsearch interfaceq<…q=}q>(hh7hh5ubaubcdocutils.nodes paragraph q?)q@}qA(hXŒThis tutorial focuses on the boto interface to AWS' Cloudsearch_. This tutorial assumes that you have boto already downloaded and installed.hh h"h#h$U paragraphqBh&}qC(h(]h)]h*]h+]h.]uh0Kh1hh2]qD(h;X4This tutorial focuses on the boto interface to AWS' qE…qF}qG(hX4This tutorial focuses on the boto interface to AWS' hh@ubcdocutils.nodes reference qH)qI}qJ(hX Cloudsearch_UresolvedqKKhh@h$U referenceqLh&}qM(UnameX CloudsearchUrefuriqNX"http://aws.amazon.com/cloudsearch/qOh+]h*]h(]h)]h.]uh2]qPh;X CloudsearchqQ…qR}qS(hUhhIubaubh;XL. This tutorial assumes that you have boto already downloaded and installed.qT…qU}qV(hXL. This tutorial assumes that you have boto already downloaded and installed.hh@ubeubcdocutils.nodes target qW)qX}qY(hX3.. _Cloudsearch: http://aws.amazon.com/cloudsearch/hKhh h"h#h$UtargetqZh&}q[(hNhOh+]q\U cloudsearchq]ah*]h(]h)]h.]q^h auh0K h1hh2]ubh)q_}q`(hUhh h"h#h$h%h&}qa(h(]h)]h*]h+]qbUcreating-a-connectionqcah.]qdh auh0K h1hh2]qe(h4)qf}qg(hXCreating a Connectionqhhh_h"h#h$h8h&}qi(h(]h)]h*]h+]h.]uh0K h1hh2]qjh;XCreating a Connectionqk…ql}qm(hhhhhfubaubh?)qn}qo(hXQThe first step in accessing CloudSearch is to create a connection to the service.qphh_h"h#h$hBh&}qq(h(]h)]h*]h+]h.]uh0Kh1hh2]qrh;XQThe first step in accessing CloudSearch is to create a connection to the service.qs…qt}qu(hhphhnubaubh?)qv}qw(hX4The recommended method of doing this is as follows::qxhh_h"h#h$hBh&}qy(h(]h)]h*]h+]h.]uh0Kh1hh2]qzh;X3The recommended method of doing this is as follows:q{…q|}q}(hX3The recommended method of doing this is as follows:hhvubaubcdocutils.nodes literal_block q~)q}q€(hXÆ>>> import boto.cloudsearch >>> conn = boto.cloudsearch.connect_to_region("us-west-2", ... aws_access_key_id='', ... aws_secret_access_key='')hh_h"h#h$U literal_blockqh&}q‚(U xml:spaceqƒUpreserveq„h+]h*]h(]h)]h.]uh0Kh1hh2]q…h;XÆ>>> import boto.cloudsearch >>> conn = boto.cloudsearch.connect_to_region("us-west-2", ... aws_access_key_id='', ... aws_secret_access_key='')q†…q‡}qˆ(hUhhubaubh?)q‰}qŠ(hXAt this point, the variable conn will point to a CloudSearch connection object in the us-west-2 region. Available regions for cloudsearch can be found `here `_. In this example, the AWS access key and AWS secret key are passed in to the method explicitly. Alternatively, you can set the environment variables:hh_h"h#h$hBh&}q‹(h(]h)]h*]h+]h.]uh0Kh1hh2]qŒ(h;X—At this point, the variable conn will point to a CloudSearch connection object in the us-west-2 region. Available regions for cloudsearch can be found q…qŽ}q(hX—At this point, the variable conn will point to a CloudSearch connection object in the us-west-2 region. Available regions for cloudsearch can be found hh‰ubhH)q}q‘(hXT`here `_h&}q’(Unameh hNXJhttp://docs.aws.amazon.com/general/latest/gr/rande.html#cloudsearch_regionq“h+]h*]h(]h)]h.]uhh‰h2]q”h;Xhereq•…q–}q—(hUhhubah$hLubhW)q˜}q™(hXM hKhh‰h$hZh&}qš(Urefurih“h+]q›Uhereqœah*]h(]h)]h.]qh auh2]ubh;X–. In this example, the AWS access key and AWS secret key are passed in to the method explicitly. Alternatively, you can set the environment variables:qž…qŸ}q (hX–. In this example, the AWS access key and AWS secret key are passed in to the method explicitly. Alternatively, you can set the environment variables:hh‰ubeubcdocutils.nodes bullet_list q¡)q¢}q£(hUhh_h"h#h$U bullet_listq¤h&}q¥(Ubulletq¦X*h+]h*]h(]h)]h.]uh0Kh1hh2]q§(cdocutils.nodes list_item q¨)q©}qª(hX,`AWS_ACCESS_KEY_ID` - Your AWS Access Key IDq«hh¢h"h#h$U list_itemq¬h&}q­(h(]h)]h*]h+]h.]uh0Nh1hh2]q®h?)q¯}q°(hh«hh©h"h#h$hBh&}q±(h(]h)]h*]h+]h.]uh0Kh2]q²(cdocutils.nodes title_reference q³)q´}qµ(hX`AWS_ACCESS_KEY_ID`h&}q¶(h(]h)]h*]h+]h.]uhh¯h2]q·h;XAWS_ACCESS_KEY_IDq¸…q¹}qº(hUhh´ubah$Utitle_referenceq»ubh;X - Your AWS Access Key IDq¼…q½}q¾(hX - Your AWS Access Key IDhh¯ubeubaubh¨)q¿}qÀ(hX5`AWS_SECRET_ACCESS_KEY` - Your AWS Secret Access Key hh¢h"h#h$h¬h&}qÁ(h(]h)]h*]h+]h.]uh0Nh1hh2]qÂh?)qÃ}qÄ(hX4`AWS_SECRET_ACCESS_KEY` - Your AWS Secret Access KeyqÅhh¿h"h#h$hBh&}qÆ(h(]h)]h*]h+]h.]uh0Kh2]qÇ(h³)qÈ}qÉ(hX`AWS_SECRET_ACCESS_KEY`h&}qÊ(h(]h)]h*]h+]h.]uhhÃh2]qËh;XAWS_SECRET_ACCESS_KEYqÌ…qÍ}qÎ(hUhhÈubah$h»ubh;X - Your AWS Secret Access KeyqÏ…qÐ}qÑ(hX - Your AWS Secret Access KeyhhÃubeubaubeubh?)qÒ}qÓ(hXand then simply call::qÔhh_h"h#h$hBh&}qÕ(h(]h)]h*]h+]h.]uh0K!h1hh2]qÖh;Xand then simply call:q×…qØ}qÙ(hXand then simply call:hhÒubaubh~)qÚ}qÛ(hXV>>> import boto.cloudsearch >>> conn = boto.cloudsearch.connect_to_region("us-west-2")hh_h"h#h$hh&}qÜ(hƒh„h+]h*]h(]h)]h.]uh0K#h1hh2]qÝh;XV>>> import boto.cloudsearch >>> conn = boto.cloudsearch.connect_to_region("us-west-2")qÞ…qß}qà(hUhhÚubaubh?)qá}qâ(hXuIn either case, conn will point to the Connection object which we will use throughout the remainder of this tutorial.qãhh_h"h#h$hBh&}qä(h(]h)]h*]h+]h.]uh0K&h1hh2]qåh;XuIn either case, conn will point to the Connection object which we will use throughout the remainder of this tutorial.qæ…qç}qè(hhãhháubaubeubh)qé}qê(hUhh h"h#h$h%h&}që(h(]h)]h*]h+]qìUcreating-a-domainqíah.]qîh auh0K*h1hh2]qï(h4)qð}qñ(hXCreating a Domainqòhhéh"h#h$h8h&}qó(h(]h)]h*]h+]h.]uh0K*h1hh2]qôh;XCreating a Domainqõ…qö}q÷(hhòhhðubaubh?)qø}qù(hXÎOnce you have a connection established with the CloudSearch service, you will want to create a domain. A domain encapsulates the data that you wish to index, as well as indexes and metadata relating to it::hhéh"h#h$hBh&}qú(h(]h)]h*]h+]h.]uh0K,h1hh2]qûh;XÍOnce you have a connection established with the CloudSearch service, you will want to create a domain. A domain encapsulates the data that you wish to index, as well as indexes and metadata relating to it:qü…qý}qþ(hXÍOnce you have a connection established with the CloudSearch service, you will want to create a domain. A domain encapsulates the data that you wish to index, as well as indexes and metadata relating to it:hhøubaubh~)qÿ}r(hXd>>> from boto.cloudsearch.domain import Domain >>> domain = Domain(conn, conn.create_domain('demo'))hhéh"h#h$hh&}r(hƒh„h+]h*]h(]h)]h.]uh0K0h1hh2]rh;Xd>>> from boto.cloudsearch.domain import Domain >>> domain = Domain(conn, conn.create_domain('demo'))r…r}r(hUhhÿubaubh?)r}r(hX…This domain can be used to control access policies, indexes, and the actual document service, which you will use to index and search.rhhéh"h#h$hBh&}r (h(]h)]h*]h+]h.]uh0K3h1hh2]r h;X…This domain can be used to control access policies, indexes, and the actual document service, which you will use to index and search.r …r }r (hjhjubaubeubh)r}r(hUhh h"h#h$h%h&}r(h(]h)]h*]h+]rUsetting-access-policiesrah.]rh auh0K7h1hh2]r(h4)r}r(hXSetting access policiesrhjh"h#h$h8h&}r(h(]h)]h*]h+]h.]uh0K7h1hh2]rh;XSetting access policiesr…r}r(hjhjubaubh?)r}r(hX¿Before you can connect to a document service, you need to set the correct access properties. For example, if you were connecting from 192.168.1.0, you could give yourself access as follows::hjh"h#h$hBh&}r(h(]h)]h*]h+]h.]uh0K9h1hh2]r h;X¾Before you can connect to a document service, you need to set the correct access properties. For example, if you were connecting from 192.168.1.0, you could give yourself access as follows:r!…r"}r#(hX¾Before you can connect to a document service, you need to set the correct access properties. For example, if you were connecting from 192.168.1.0, you could give yourself access as follows:hjubaubh~)r$}r%(hXÎ>>> our_ip = '192.168.1.0' >>> # Allow our IP address to access the document and search services >>> policy = domain.get_access_policies() >>> policy.allow_search_ip(our_ip) >>> policy.allow_doc_ip(our_ip)hjh"h#h$hh&}r&(hƒh„h+]h*]h(]h)]h.]uh0K=h1hh2]r'h;XÎ>>> our_ip = '192.168.1.0' >>> # Allow our IP address to access the document and search services >>> policy = domain.get_access_policies() >>> policy.allow_search_ip(our_ip) >>> policy.allow_doc_ip(our_ip)r(…r)}r*(hUhj$ubaubh?)r+}r,(hX0You can use the :py:meth:`allow_search_ip ` and :py:meth:`allow_doc_ip ` methods to give different CIDR blocks access to searching and the document service respectively.hjh"h#h$hBh&}r-(h(]h)]h*]h+]h.]uh0KDh1hh2]r.(h;XYou can use the r/…r0}r1(hXYou can use the hj+ubcsphinx.addnodes pending_xref r2)r3}r4(hX`:py:meth:`allow_search_ip `r5hj+h"h#h$U pending_xrefr6h&}r7(UreftypeXmethUrefwarnr8‰U reftargetr9XCboto.cloudsearch.optionstatus.ServicePoliciesStatus.allow_search_ipU refdomainXpyr:h+]h*]U refexplicitˆh(]h)]h.]Urefdocr;Xcloudsearch_tutr<Upy:classr=NU py:moduler>Nuh0KDh2]r?cdocutils.nodes literal r@)rA}rB(hj5h&}rC(h(]h)]rD(UxrefrEj:Xpy-methrFeh*]h+]h.]uhj3h2]rGh;Xallow_search_iprH…rI}rJ(hUhjAubah$UliteralrKubaubh;X and rL…rM}rN(hX and hj+ubj2)rO}rP(hXZ:py:meth:`allow_doc_ip `rQhj+h"h#h$j6h&}rR(UreftypeXmethj8‰j9X@boto.cloudsearch.optionstatus.ServicePoliciesStatus.allow_doc_ipU refdomainXpyrSh+]h*]U refexplicitˆh(]h)]h.]j;j<j=Nj>Nuh0KDh2]rTj@)rU}rV(hjQh&}rW(h(]h)]rX(jEjSXpy-methrYeh*]h+]h.]uhjOh2]rZh;X allow_doc_ipr[…r\}r](hUhjUubah$jKubaubh;Xa methods to give different CIDR blocks access to searching and the document service respectively.r^…r_}r`(hXa methods to give different CIDR blocks access to searching and the document service respectively.hj+ubeubeubh)ra}rb(hUhh h"h#h$h%h&}rc(h(]h)]h*]h+]rdUcreating-index-fieldsreah.]rfhauh0KKh1hh2]rg(h4)rh}ri(hXCreating index fieldsrjhjah"h#h$h8h&}rk(h(]h)]h*]h+]h.]uh0KKh1hh2]rlh;XCreating index fieldsrm…rn}ro(hjjhjhubaubh?)rp}rq(hXØEach domain can have up to twenty index fields which are indexed by the CloudSearch service. For each index field, you will need to specify whether it's a text or integer field, as well as optionaly a default value::hjah"h#h$hBh&}rr(h(]h)]h*]h+]h.]uh0KMh1hh2]rsh;X×Each domain can have up to twenty index fields which are indexed by the CloudSearch service. For each index field, you will need to specify whether it's a text or integer field, as well as optionaly a default value:rt…ru}rv(hX×Each domain can have up to twenty index fields which are indexed by the CloudSearch service. For each index field, you will need to specify whether it's a text or integer field, as well as optionaly a default value:hjpubaubh~)rw}rx(hXO>>> # Create an 'text' index field called 'username' >>> uname_field = domain.create_index_field('username', 'text') >>> # Epoch time of when the user last did something >>> time_field = domain.create_index_field('last_activity', ... 'uint', ... default=0)hjah"h#h$hh&}ry(hƒh„h+]h*]h(]h)]h.]uh0KQh1hh2]rzh;XO>>> # Create an 'text' index field called 'username' >>> uname_field = domain.create_index_field('username', 'text') >>> # Epoch time of when the user last did something >>> time_field = domain.create_index_field('last_activity', ... 'uint', ... default=0)r{…r|}r}(hUhjwubaubh?)r~}r(hX²It is also possible to mark an index field as a facet. Doing so allows a search query to return categories into which results can be grouped, or to create drill-down categories::hjah"h#h$hBh&}r€(h(]h)]h*]h+]h.]uh0KYh1hh2]rh;X±It is also possible to mark an index field as a facet. Doing so allows a search query to return categories into which results can be grouped, or to create drill-down categories:r‚…rƒ}r„(hX±It is also possible to mark an index field as a facet. Doing so allows a search query to return categories into which results can be grouped, or to create drill-down categories:hj~ubaubh~)r…}r†(hX‹>>> # But it would be neat to drill down into different countries >>> loc_field = domain.create_index_field('location', 'text', facet=True)hjah"h#h$hh&}r‡(hƒh„h+]h*]h(]h)]h.]uh0K]h1hh2]rˆh;X‹>>> # But it would be neat to drill down into different countries >>> loc_field = domain.create_index_field('location', 'text', facet=True)r‰…rŠ}r‹(hUhj…ubaubh?)rŒ}r(hX…Finally, you can also mark a snippet of text as being able to be returned directly in your search query by using the results option::hjah"h#h$hBh&}rŽ(h(]h)]h*]h+]h.]uh0K`h1hh2]rh;X„Finally, you can also mark a snippet of text as being able to be returned directly in your search query by using the results option:r…r‘}r’(hX„Finally, you can also mark a snippet of text as being able to be returned directly in your search query by using the results option:hjŒubaubh~)r“}r”(hX€>>> # Directly insert user snippets in our results >>> snippet_field = domain.create_index_field('snippet', 'text', result=True)hjah"h#h$hh&}r•(hƒh„h+]h*]h(]h)]h.]uh0Kch1hh2]r–h;X€>>> # Directly insert user snippets in our results >>> snippet_field = domain.create_index_field('snippet', 'text', result=True)r—…r˜}r™(hUhj“ubaubh?)rš}r›(hX2You can add up to 20 index fields in this manner::rœhjah"h#h$hBh&}r(h(]h)]h*]h+]h.]uh0Kfh1hh2]ržh;X1You can add up to 20 index fields in this manner:rŸ…r }r¡(hX1You can add up to 20 index fields in this manner:hjšubaubh~)r¢}r£(hX±>>> follower_field = domain.create_index_field('follower_count', ... 'uint', ... default=0)hjah"h#h$hh&}r¤(hƒh„h+]h*]h(]h)]h.]uh0Khh1hh2]r¥h;X±>>> follower_field = domain.create_index_field('follower_count', ... 'uint', ... default=0)r¦…r§}r¨(hUhj¢ubaubeubh)r©}rª(hUhh h"h#h$h%h&}r«(h(]h)]h*]h+]r¬Uadding-documents-to-the-indexr­ah.]r®hauh0Kmh1hh2]r¯(h4)r°}r±(hXAdding Documents to the Indexr²hj©h"h#h$h8h&}r³(h(]h)]h*]h+]h.]uh0Kmh1hh2]r´h;XAdding Documents to the Indexrµ…r¶}r·(hj²hj°ubaubh?)r¸}r¹(hXˆNow, we can add some documents to our new search domain. First, you will need a document service object through which queries are sent::hj©h"h#h$hBh&}rº(h(]h)]h*]h+]h.]uh0Koh1hh2]r»h;X‡Now, we can add some documents to our new search domain. First, you will need a document service object through which queries are sent:r¼…r½}r¾(hX‡Now, we can add some documents to our new search domain. First, you will need a document service object through which queries are sent:hj¸ubaubh~)r¿}rÀ(hX/>>> doc_service = domain.get_document_service()hj©h"h#h$hh&}rÁ(hƒh„h+]h*]h(]h)]h.]uh0Krh1hh2]rÂh;X/>>> doc_service = domain.get_document_service()rÃ…rÄ}rÅ(hUhj¿ubaubh?)rÆ}rÇ(hX¥For this example, we will use a pre-populated list of sample content for our import. You would normally pull such data from your database or another document store::hj©h"h#h$hBh&}rÈ(h(]h)]h*]h+]h.]uh0Kth1hh2]rÉh;X¤For this example, we will use a pre-populated list of sample content for our import. You would normally pull such data from your database or another document store:rÊ…rË}rÌ(hX¤For this example, we will use a pre-populated list of sample content for our import. You would normally pull such data from your database or another document store:hjÆubaubh~)rÍ}rÎ(hXw>>> users = [ { 'id': 1, 'username': 'dan', 'last_activity': 1334252740, 'follower_count': 20, 'location': 'USA', 'snippet': 'Dan likes watching sunsets and rock climbing', }, { 'id': 2, 'username': 'dankosaur', 'last_activity': 1334252904, 'follower_count': 1, 'location': 'UK', 'snippet': 'Likes to dress up as a dinosaur.', }, { 'id': 3, 'username': 'danielle', 'last_activity': 1334252969, 'follower_count': 100, 'location': 'DE', 'snippet': 'Just moved to Germany!' }, { 'id': 4, 'username': 'daniella', 'last_activity': 1334253279, 'follower_count': 7, 'location': 'USA', 'snippet': 'Just like Dan, I like to watch a good sunset, but heights scare me.', } ]hj©h"h#h$hh&}rÏ(hƒh„h+]h*]h(]h)]h.]uh0Kxh1hh2]rÐh;Xw>>> users = [ { 'id': 1, 'username': 'dan', 'last_activity': 1334252740, 'follower_count': 20, 'location': 'USA', 'snippet': 'Dan likes watching sunsets and rock climbing', }, { 'id': 2, 'username': 'dankosaur', 'last_activity': 1334252904, 'follower_count': 1, 'location': 'UK', 'snippet': 'Likes to dress up as a dinosaur.', }, { 'id': 3, 'username': 'danielle', 'last_activity': 1334252969, 'follower_count': 100, 'location': 'DE', 'snippet': 'Just moved to Germany!' }, { 'id': 4, 'username': 'daniella', 'last_activity': 1334253279, 'follower_count': 7, 'location': 'USA', 'snippet': 'Just like Dan, I like to watch a good sunset, but heights scare me.', } ]rÑ…rÒ}rÓ(hUhjÍubaubh?)rÔ}rÕ(hXwWhen adding documents to our document service, we will batch them together. You can schedule a document to be added by using the :py:meth:`add ` method. Whenever you are adding a document, you must provide a unique ID, a version ID, and the actual document to be indexed. In this case, we are using the user ID as our unique ID. The version ID is used to determine which is the latest version of an object to be indexed. If you wish to update a document, you must use a higher version ID. In this case, we are using the time of the user's last activity as a version number::hj©h"h#h$hBh&}rÖ(h(]h)]h*]h+]h.]uh0K›h1hh2]r×(h;XWhen adding documents to our document service, we will batch them together. You can schedule a document to be added by using the rØ…rÙ}rÚ(hXWhen adding documents to our document service, we will batch them together. You can schedule a document to be added by using the hjÔubj2)rÛ}rÜ(hXH:py:meth:`add `rÝhjÔh"h#h$j6h&}rÞ(UreftypeXmethj8‰j9X7boto.cloudsearch.document.DocumentServiceConnection.addU refdomainXpyrßh+]h*]U refexplicitˆh(]h)]h.]j;j<j=Nj>Nuh0K›h2]ràj@)rá}râ(hjÝh&}rã(h(]h)]rä(jEjßXpy-methråeh*]h+]h.]uhjÛh2]ræh;Xaddrç…rè}ré(hUhjáubah$jKubaubh;X­ method. Whenever you are adding a document, you must provide a unique ID, a version ID, and the actual document to be indexed. In this case, we are using the user ID as our unique ID. The version ID is used to determine which is the latest version of an object to be indexed. If you wish to update a document, you must use a higher version ID. In this case, we are using the time of the user's last activity as a version number:rê…rë}rì(hX­ method. Whenever you are adding a document, you must provide a unique ID, a version ID, and the actual document to be indexed. In this case, we are using the user ID as our unique ID. The version ID is used to determine which is the latest version of an object to be indexed. If you wish to update a document, you must use a higher version ID. In this case, we are using the time of the user's last activity as a version number:hjÔubeubh~)rí}rî(hXW>>> for user in users: >>> doc_service.add(user['id'], user['last_activity'], user)hj©h"h#h$hh&}rï(hƒh„h+]h*]h(]h)]h.]uh0K¥h1hh2]rðh;XW>>> for user in users: >>> doc_service.add(user['id'], user['last_activity'], user)rñ…rò}ró(hUhjíubaubh?)rô}rõ(hXWhen you are ready to send the batched request to the document service, you can do with the :py:meth:`commit ` method. Note that cloudsearch will charge per 1000 batch uploads. Each batch upload must be under 5MB::hj©h"h#h$hBh&}rö(h(]h)]h*]h+]h.]uh0K¨h1hh2]r÷(h;X\When you are ready to send the batched request to the document service, you can do with the rø…rù}rú(hX\When you are ready to send the batched request to the document service, you can do with the hjôubj2)rû}rü(hXN:py:meth:`commit `rýhjôh"h#h$j6h&}rþ(UreftypeXmethj8‰j9X:boto.cloudsearch.document.DocumentServiceConnection.commitU refdomainXpyrÿh+]h*]U refexplicitˆh(]h)]h.]j;j<j=Nj>Nuh0K¨h2]rj@)r}r(hjýh&}r(h(]h)]r(jEjÿXpy-methreh*]h+]h.]uhjûh2]rh;Xcommitr…r}r (hUhjubah$jKubaubh;Xg method. Note that cloudsearch will charge per 1000 batch uploads. Each batch upload must be under 5MB:r …r }r (hXg method. Note that cloudsearch will charge per 1000 batch uploads. Each batch upload must be under 5MB:hjôubeubh~)r }r(hX!>>> result = doc_service.commit()hj©h"h#h$hh&}r(hƒh„h+]h*]h(]h)]h.]uh0K®h1hh2]rh;X!>>> result = doc_service.commit()r…r}r(hUhj ubaubh?)r}r(hXThe result is an instance of :py:class:`CommitResponse ` which will make the plain dictionary response a nice object (ie result.adds, result.deletes) and raise an exception for us if all of our documents weren't actually committed.hj©h"h#h$hBh&}r(h(]h)]h*]h+]h.]uh0K°h1hh2]r(h;XThe result is an instance of r…r}r(hXThe result is an instance of hjubj2)r}r(hXE:py:class:`CommitResponse `rhjh"h#h$j6h&}r(UreftypeXclassj8‰j9X(boto.cloudsearch.document.CommitResponseU refdomainXpyrh+]h*]U refexplicitˆh(]h)]h.]j;j<j=Nj>Nuh0K°h2]r j@)r!}r"(hjh&}r#(h(]h)]r$(jEjXpy-classr%eh*]h+]h.]uhjh2]r&h;XCommitResponser'…r(}r)(hUhj!ubah$jKubaubh;X¯ which will make the plain dictionary response a nice object (ie result.adds, result.deletes) and raise an exception for us if all of our documents weren't actually committed.r*…r+}r,(hX¯ which will make the plain dictionary response a nice object (ie result.adds, result.deletes) and raise an exception for us if all of our documents weren't actually committed.hjubeubh?)r-}r.(hX After you have successfully committed some documents to cloudsearch, you must use :py:meth:`clear_sdf `, if you wish to use the same document service connection again so that its internal cache is cleared.hj©h"h#h$hBh&}r/(h(]h)]h*]h+]h.]uh0Kµh1hh2]r0(h;XRAfter you have successfully committed some documents to cloudsearch, you must use r1…r2}r3(hXRAfter you have successfully committed some documents to cloudsearch, you must use hj-ubj2)r4}r5(hXT:py:meth:`clear_sdf `r6hj-h"h#h$j6h&}r7(UreftypeXmethj8‰j9X=boto.cloudsearch.document.DocumentServiceConnection.clear_sdfU refdomainXpyr8h+]h*]U refexplicitˆh(]h)]h.]j;j<j=Nj>Nuh0Kµh2]r9j@)r:}r;(hj6h&}r<(h(]h)]r=(jEj8Xpy-methr>eh*]h+]h.]uhj4h2]r?h;X clear_sdfr@…rA}rB(hUhj:ubah$jKubaubh;Xf, if you wish to use the same document service connection again so that its internal cache is cleared.rC…rD}rE(hXf, if you wish to use the same document service connection again so that its internal cache is cleared.hj-ubeubeubh)rF}rG(hUhh h"h#h$h%h&}rH(h(]h)]h*]h+]rIUsearching-documentsrJah.]rKhauh0K¼h1hh2]rL(h4)rM}rN(hXSearching DocumentsrOhjFh"h#h$h8h&}rP(h(]h)]h*]h+]h.]uh0K¼h1hh2]rQh;XSearching DocumentsrR…rS}rT(hjOhjMubaubh?)rU}rV(hXSNow, let's try performing a search. First, we will need a SearchServiceConnection::hjFh"h#h$hBh&}rW(h(]h)]h*]h+]h.]uh0K¾h1hh2]rXh;XRNow, let's try performing a search. First, we will need a SearchServiceConnection:rY…rZ}r[(hXRNow, let's try performing a search. First, we will need a SearchServiceConnection:hjUubaubh~)r\}r](hX0>>> search_service = domain.get_search_service()hjFh"h#h$hh&}r^(hƒh„h+]h*]h(]h)]h.]uh0KÁh1hh2]r_h;X0>>> search_service = domain.get_search_service()r`…ra}rb(hUhj\ubaubh?)rc}rd(hXZA standard search will return documents which contain the exact words being searched for::hjFh"h#h$hBh&}re(h(]h)]h*]h+]h.]uh0KÃh1hh2]rfh;XYA standard search will return documents which contain the exact words being searched for:rg…rh}ri(hXYA standard search will return documents which contain the exact words being searched for:hjcubaubh~)rj}rk(hXp>>> results = search_service.search(q="dan") >>> results.hits 2 >>> map(lambda x: x['id'], results) [u'1', u'4']hjFh"h#h$hh&}rl(hƒh„h+]h*]h(]h)]h.]uh0KÆh1hh2]rmh;Xp>>> results = search_service.search(q="dan") >>> results.hits 2 >>> map(lambda x: x['id'], results) [u'1', u'4']rn…ro}rp(hUhjjubaubh?)rq}rr(hX1The standard search does not look at word order::rshjFh"h#h$hBh&}rt(h(]h)]h*]h+]h.]uh0KÌh1hh2]ruh;X0The standard search does not look at word order:rv…rw}rx(hX0The standard search does not look at word order:hjqubaubh~)ry}rz(hXu>>> results = search_service.search(q="dinosaur dress") >>> results.hits 1 >>> map(lambda x: x['id'], results) [u'2']hjFh"h#h$hh&}r{(hƒh„h+]h*]h(]h)]h.]uh0KÎh1hh2]r|h;Xu>>> results = search_service.search(q="dinosaur dress") >>> results.hits 1 >>> map(lambda x: x['id'], results) [u'2']r}…r~}r(hUhjyubaubh?)r€}r(hX¡It's also possible to do more complex queries using the bq argument (Boolean Query). When you are using bq, your search terms must be enclosed in single quotes::hjFh"h#h$hBh&}r‚(h(]h)]h*]h+]h.]uh0KÔh1hh2]rƒh;X It's also possible to do more complex queries using the bq argument (Boolean Query). When you are using bq, your search terms must be enclosed in single quotes:r„…r…}r†(hX It's also possible to do more complex queries using the bq argument (Boolean Query). When you are using bq, your search terms must be enclosed in single quotes:hj€ubaubh~)r‡}rˆ(hXs>>> results = search_service.search(bq="'dan'") >>> results.hits 2 >>> map(lambda x: x['id'], results) [u'1', u'4']hjFh"h#h$hh&}r‰(hƒh„h+]h*]h(]h)]h.]uh0KØh1hh2]rŠh;Xs>>> results = search_service.search(bq="'dan'") >>> results.hits 2 >>> map(lambda x: x['id'], results) [u'1', u'4']r‹…rŒ}r(hUhj‡ubaubh?)rŽ}r(hXWhen you are using boolean queries, it's also possible to use wildcards to extend your search to all words which start with your search terms::hjFh"h#h$hBh&}r(h(]h)]h*]h+]h.]uh0KÞh1hh2]r‘h;XŽWhen you are using boolean queries, it's also possible to use wildcards to extend your search to all words which start with your search terms:r’…r“}r”(hXŽWhen you are using boolean queries, it's also possible to use wildcards to extend your search to all words which start with your search terms:hjŽubaubh~)r•}r–(hX€>>> results = search_service.search(bq="'dan*'") >>> results.hits 4 >>> map(lambda x: x['id'], results) [u'1', u'2', u'3', u'4']hjFh"h#h$hh&}r—(hƒh„h+]h*]h(]h)]h.]uh0Káh1hh2]r˜h;X€>>> results = search_service.search(bq="'dan*'") >>> results.hits 4 >>> map(lambda x: x['id'], results) [u'1', u'2', u'3', u'4']r™…rš}r›(hUhj•ubaubh?)rœ}r(hXÏThe boolean query also allows you to create more complex queries. You can OR term together using "|", AND terms together using "+" or a space, and you can remove words from the query using the "-" operator::hjFh"h#h$hBh&}rž(h(]h)]h*]h+]h.]uh0Kçh1hh2]rŸh;XÎThe boolean query also allows you to create more complex queries. You can OR term together using "|", AND terms together using "+" or a space, and you can remove words from the query using the "-" operator:r …r¡}r¢(hXÎThe boolean query also allows you to create more complex queries. You can OR term together using "|", AND terms together using "+" or a space, and you can remove words from the query using the "-" operator:hjœubaubh~)r£}r¤(hX}>>> results = search_service.search(bq="'watched|moved'") >>> results.hits 2 >>> map(lambda x: x['id'], results) [u'3', u'4']hjFh"h#h$hh&}r¥(hƒh„h+]h*]h(]h)]h.]uh0Këh1hh2]r¦h;X}>>> results = search_service.search(bq="'watched|moved'") >>> results.hits 2 >>> map(lambda x: x['id'], results) [u'3', u'4']r§…r¨}r©(hUhj£ubaubh?)rª}r«(hXuBy default, the search will return 10 terms but it is possible to adjust this by using the size argument as follows::hjFh"h#h$hBh&}r¬(h(]h)]h*]h+]h.]uh0Kñh1hh2]r­h;XtBy default, the search will return 10 terms but it is possible to adjust this by using the size argument as follows:r®…r¯}r°(hXtBy default, the search will return 10 terms but it is possible to adjust this by using the size argument as follows:hjªubaubh~)r±}r²(hX|>>> results = search_service.search(bq="'dan*'", size=2) >>> results.hits 4 >>> map(lambda x: x['id'], results) [u'1', u'2']hjFh"h#h$hh&}r³(hƒh„h+]h*]h(]h)]h.]uh0Kôh1hh2]r´h;X|>>> results = search_service.search(bq="'dan*'", size=2) >>> results.hits 4 >>> map(lambda x: x['id'], results) [u'1', u'2']rµ…r¶}r·(hUhj±ubaubh?)r¸}r¹(hX^It is also possible to offset the start of the search by using the start argument as follows::hjFh"h#h$hBh&}rº(h(]h)]h*]h+]h.]uh0Kúh1hh2]r»h;X]It is also possible to offset the start of the search by using the start argument as follows:r¼…r½}r¾(hX]It is also possible to offset the start of the search by using the start argument as follows:hj¸ubaubh~)r¿}rÀ(hX}>>> results = search_service.search(bq="'dan*'", start=2) >>> results.hits 4 >>> map(lambda x: x['id'], results) [u'3', u'4']hjFh"h#h$hh&}rÁ(hƒh„h+]h*]h(]h)]h.]uh0Kýh1hh2]rÂh;X}>>> results = search_service.search(bq="'dan*'", start=2) >>> results.hits 4 >>> map(lambda x: x['id'], results) [u'3', u'4']rÃ…rÄ}rÅ(hUhj¿ubaubeubh)rÆ}rÇ(hUhh h"h#h$h%h&}rÈ(h(]h)]h*]h+]rÉU,ordering-search-results-and-rank-expressionsrÊah.]rËhauh0Mh1hh2]rÌ(h4)rÍ}rÎ(hX,Ordering search results and rank expressionsrÏhjÆh"h#h$h8h&}rÐ(h(]h)]h*]h+]h.]uh0Mh1hh2]rÑh;X,Ordering search results and rank expressionsrÒ…rÓ}rÔ(hjÏhjÍubaubh?)rÕ}rÖ(hXäIf your search query is going to return many results, it is good to be able to sort them. You can order your search results by using the rank argument. You are able to sort on any fields which have the results option turned on::hjÆh"h#h$hBh&}r×(h(]h)]h*]h+]h.]uh0Mh1hh2]rØh;XãIf your search query is going to return many results, it is good to be able to sort them. You can order your search results by using the rank argument. You are able to sort on any fields which have the results option turned on:rÙ…rÚ}rÛ(hXãIf your search query is going to return many results, it is good to be able to sort them. You can order your search results by using the rank argument. You are able to sort on any fields which have the results option turned on:hjÕubaubh~)rÜ}rÝ(hXG>>> results = search_service.search(bq=query, rank=['-follower_count'])hjÆh"h#h$hh&}rÞ(hƒh„h+]h*]h(]h)]h.]uh0M h1hh2]rßh;XG>>> results = search_service.search(bq=query, rank=['-follower_count'])rà…rá}râ(hUhjÜubaubh?)rã}rä(hXÃYou can also create your own rank expressions to sort your results according to other criteria, such as showing most recently active user, or combining the recency score with the text_relevance::hjÆh"h#h$hBh&}rå(h(]h)]h*]h+]h.]uh0M h1hh2]ræh;XÂYou can also create your own rank expressions to sort your results according to other criteria, such as showing most recently active user, or combining the recency score with the text_relevance:rç…rè}ré(hXÂYou can also create your own rank expressions to sort your results according to other criteria, such as showing most recently active user, or combining the recency score with the text_relevance:hjãubaubh~)rê}rë(hX >>> domain.create_rank_expression('recently_active', 'last_activity') >>> domain.create_rank_expression('activish', ... 'text_relevance + ((follower_count/(time() - last_activity))*1000)') >>> results = search_service.search(bq=query, rank=['-recently_active'])hjÆh"h#h$hh&}rì(hƒh„h+]h*]h(]h)]h.]uh0Mh1hh2]ríh;X >>> domain.create_rank_expression('recently_active', 'last_activity') >>> domain.create_rank_expression('activish', ... 'text_relevance + ((follower_count/(time() - last_activity))*1000)') >>> results = search_service.search(bq=query, rank=['-recently_active'])rî…rï}rð(hUhjêubaubeubh)rñ}rò(hUhh h"h#h$h%h&}ró(h(]h)]h*]h+]rôU+viewing-and-adjusting-stemming-for-a-domainrõah.]röhauh0Mh1hh2]r÷(h4)rø}rù(hX+Viewing and Adjusting Stemming for a Domainrúhjñh"h#h$h8h&}rû(h(]h)]h*]h+]h.]uh0Mh1hh2]rüh;X+Viewing and Adjusting Stemming for a Domainrý…rþ}rÿ(hjúhjøubaubh?)r}r(hXPA stemming dictionary maps related words to a common stem. A stem is typically the root or base word from which variants are derived. For example, run is the stem of running and ran. During indexing, Amazon CloudSearch uses the stemming dictionary when it performs text-processing on text fields. At search time, the stemming dictionary is used to perform text-processing on the search request. This enables matching on variants of a word. For example, if you map the term running to the stem run and then search for running, the request matches documents that contain run as well as running.rhjñh"h#h$hBh&}r(h(]h)]h*]h+]h.]uh0Mh1hh2]rh;XPA stemming dictionary maps related words to a common stem. A stem is typically the root or base word from which variants are derived. For example, run is the stem of running and ran. During indexing, Amazon CloudSearch uses the stemming dictionary when it performs text-processing on text fields. At search time, the stemming dictionary is used to perform text-processing on the search request. This enables matching on variants of a word. For example, if you map the term running to the stem run and then search for running, the request matches documents that contain run as well as running.r…r}r(hjhjubaubh?)r}r (hX“To get the current stemming dictionary defined for a domain, use the :py:meth:`get_stemming ` method::hjñh"h#h$hBh&}r (h(]h)]h*]h+]h.]uh0M%h1hh2]r (h;XETo get the current stemming dictionary defined for a domain, use the r …r }r(hXETo get the current stemming dictionary defined for a domain, use the hjubj2)r}r(hXE:py:meth:`get_stemming `rhjh"h#h$j6h&}r(UreftypeXmethj8‰j9X+boto.cloudsearch.domain.Domain.get_stemmingU refdomainXpyrh+]h*]U refexplicitˆh(]h)]h.]j;j<j=Nj>Nuh0M%h2]rj@)r}r(hjh&}r(h(]h)]r(jEjXpy-methreh*]h+]h.]uhjh2]rh;X get_stemmingr…r}r(hUhjubah$jKubaubh;X method:r…r}r (hX method:hjubeubh~)r!}r"(hX>>>> stems = domain.get_stemming() >>> stems {u'stems': {}} >>>hjñh"h#h$hh&}r#(hƒh„h+]h*]h(]h)]h.]uh0M(h1hh2]r$h;X>>>> stems = domain.get_stemming() >>> stems {u'stems': {}} >>>r%…r&}r'(hUhj!ubaubh?)r(}r)(hX§This returns a dictionary object that can be manipulated directly to add additional stems for your search domain by adding pairs of term:stem to the stems dictionary::hjñh"h#h$hBh&}r*(h(]h)]h*]h+]h.]uh0M-h1hh2]r+h;X¦This returns a dictionary object that can be manipulated directly to add additional stems for your search domain by adding pairs of term:stem to the stems dictionary:r,…r-}r.(hX¦This returns a dictionary object that can be manipulated directly to add additional stems for your search domain by adding pairs of term:stem to the stems dictionary:hj(ubaubh~)r/}r0(hX†>>> stems['stems']['running'] = 'run' >>> stems['stems']['ran'] = 'run' >>> stems {u'stems': {u'ran': u'run', u'running': u'run'}} >>>hjñh"h#h$hh&}r1(hƒh„h+]h*]h(]h)]h.]uh0M1h1hh2]r2h;X†>>> stems['stems']['running'] = 'run' >>> stems['stems']['ran'] = 'run' >>> stems {u'stems': {u'ran': u'run', u'running': u'run'}} >>>r3…r4}r5(hUhj/ubaubh?)r6}r7(hXqThis has changed the value locally. To update the information in Amazon CloudSearch, you need to save the data::hjñh"h#h$hBh&}r8(h(]h)]h*]h+]h.]uh0M7h1hh2]r9h;XpThis has changed the value locally. To update the information in Amazon CloudSearch, you need to save the data:r:…r;}r<(hXpThis has changed the value locally. To update the information in Amazon CloudSearch, you need to save the data:hj6ubaubh~)r=}r>(hX>>> stems.save()hjñh"h#h$hh&}r?(hƒh„h+]h*]h(]h)]h.]uh0M:h1hh2]r@h;X>>> stems.save()rA…rB}rC(hUhj=ubaubh?)rD}rE(hXxYou can also access certain CloudSearch-specific attributes related to the stemming dictionary defined for your domain::hjñh"h#h$hBh&}rF(h(]h)]h*]h+]h.]uh0M<h1hh2]rGh;XwYou can also access certain CloudSearch-specific attributes related to the stemming dictionary defined for your domain:rH…rI}rJ(hXwYou can also access certain CloudSearch-specific attributes related to the stemming dictionary defined for your domain:hjDubaubh~)rK}rL(hX¨>>> stems.status u'RequiresIndexDocuments' >>> stems.creation_date u'2012-05-01T12:12:32Z' >>> stems.update_date u'2012-05-01T12:12:32Z' >>> stems.update_version 19 >>>hjñh"h#h$hh&}rM(hƒh„h+]h*]h(]h)]h.]uh0M?h1hh2]rNh;X¨>>> stems.status u'RequiresIndexDocuments' >>> stems.creation_date u'2012-05-01T12:12:32Z' >>> stems.update_date u'2012-05-01T12:12:32Z' >>> stems.update_version 19 >>>rO…rP}rQ(hUhjKubaubh?)rR}rS(hX®The status indicates that, because you have changed the stems associated with the domain, you will need to re-index the documents in the domain before the new stems are used.rThjñh"h#h$hBh&}rU(h(]h)]h*]h+]h.]uh0MIh1hh2]rVh;X®The status indicates that, because you have changed the stems associated with the domain, you will need to re-index the documents in the domain before the new stems are used.rW…rX}rY(hjThjRubaubeubh)rZ}r[(hUhKhh h"h#h$h%h&}r\(h(]r]X,viewing and adjusting stopwords for a domainr^ah)]h*]h+]r_U,viewing-and-adjusting-stopwords-for-a-domainr`ah.]uh0MNh1hh2]ra(h4)rb}rc(hX,Viewing and Adjusting Stopwords for a DomainrdhjZh"h#h$h8h&}re(h(]h)]h*]h+]h.]uh0MNh1hh2]rfh;X,Viewing and Adjusting Stopwords for a Domainrg…rh}ri(hjdhjbubaubh?)rj}rk(hXÐStopwords are words that should typically be ignored both during indexing and at search time because they are either insignificant or so common that including them would result in a massive number of matches.rlhjZh"h#h$hBh&}rm(h(]h)]h*]h+]h.]uh0MPh1hh2]rnh;XÐStopwords are words that should typically be ignored both during indexing and at search time because they are either insignificant or so common that including them would result in a massive number of matches.ro…rp}rq(hjlhjjubaubh?)rr}rs(hX‘To view the stopwords currently defined for your domain, use the :py:meth:`get_stopwords ` method::hjZh"h#h$hBh&}rt(h(]h)]h*]h+]h.]uh0MUh1hh2]ru(h;XATo view the stopwords currently defined for your domain, use the rv…rw}rx(hXATo view the stopwords currently defined for your domain, use the hjrubj2)ry}rz(hXG:py:meth:`get_stopwords `r{hjrh"h#h$j6h&}r|(UreftypeXmethj8‰j9X,boto.cloudsearch.domain.Domain.get_stopwordsU refdomainXpyr}h+]h*]U refexplicitˆh(]h)]h.]j;j<j=Nj>Nuh0MUh2]r~j@)r}r€(hj{h&}r(h(]h)]r‚(jEj}Xpy-methrƒeh*]h+]h.]uhjyh2]r„h;X get_stopwordsr……r†}r‡(hUhjubah$jKubaubh;X method:rˆ…r‰}rŠ(hX method:hjrubeubh~)r‹}rŒ(hXå>>> stopwords = domain.get_stopwords() >>> stopwords {u'stopwords': [u'a', u'an', u'and', u'are', u'as', u'at', u'be', u'but', u'by', u'for', u'in', u'is', u'it', u'of', u'on', u'or', u'the', u'to', u'was']} >>>hjZh"h#h$hh&}r(hƒh„h+]h*]h(]h)]h.]uh0MXh1hh2]rŽh;Xå>>> stopwords = domain.get_stopwords() >>> stopwords {u'stopwords': [u'a', u'an', u'and', u'are', u'as', u'at', u'be', u'but', u'by', u'for', u'in', u'is', u'it', u'of', u'on', u'or', u'the', u'to', u'was']} >>>r…r}r‘(hUhj‹ubaubh?)r’}r“(hXMYou can add additional stopwords by simply appending the values to the list::hjZh"h#h$hBh&}r”(h(]h)]h*]h+]h.]uh0Moh1hh2]r•h;XLYou can add additional stopwords by simply appending the values to the list:r–…r—}r˜(hXLYou can add additional stopwords by simply appending the values to the list:hj’ubaubh~)r™}rš(hX_>>> stopwords['stopwords'].append('foo') >>> stopwords['stopwords'].append('bar') >>> stopwordshjZh"h#h$hh&}r›(hƒh„h+]h*]h(]h)]h.]uh0Mrh1hh2]rœh;X_>>> stopwords['stopwords'].append('foo') >>> stopwords['stopwords'].append('bar') >>> stopwordsr…rž}rŸ(hUhj™ubaubh?)r }r¡(hX®Similarly, you could remove currently defined stopwords from the list. To save the changes, use the :py:meth:`save ` method::hjZh"h#h$hBh&}r¢(h(]h)]h*]h+]h.]uh0Mvh1hh2]r£(h;XdSimilarly, you could remove currently defined stopwords from the list. To save the changes, use the r¤…r¥}r¦(hXdSimilarly, you could remove currently defined stopwords from the list. To save the changes, use the hj ubj2)r§}r¨(hXA:py:meth:`save `r©hj h"h#h$j6h&}rª(UreftypeXmethj8‰j9X/boto.cloudsearch.optionstatus.OptionStatus.saveU refdomainXpyr«h+]h*]U refexplicitˆh(]h)]h.]j;j<j=Nj>Nuh0Mvh2]r¬j@)r­}r®(hj©h&}r¯(h(]h)]r°(jEj«Xpy-methr±eh*]h+]h.]uhj§h2]r²h;Xsaver³…r´}rµ(hUhj­ubah$jKubaubh;X method:r¶…r·}r¸(hX method:hj ubeubh~)r¹}rº(hX>>> stopwords.save()hjZh"h#h$hh&}r»(hƒh„h+]h*]h(]h)]h.]uh0Mzh1hh2]r¼h;X>>> stopwords.save()r½…r¾}r¿(hUhj¹ubaubh?)rÀ}rÁ(hXŽThe stopwords object has similar attributes defined above for stemming that provide additional information about the stopwords in your domain.rÂhjZh"h#h$hBh&}rÃ(h(]h)]h*]h+]h.]uh0M|h1hh2]rÄh;XŽThe stopwords object has similar attributes defined above for stemming that provide additional information about the stopwords in your domain.rÅ…rÆ}rÇ(hjÂhjÀubaubeubhh)rÈ}rÉ(hUhh h"h#h$h%h&}rÊ(h(]h)]h*]h+]rËUdeleting-documentsrÌah.]rÍhauh0M¥h1hh2]rÎ(h4)rÏ}rÐ(hXDeleting DocumentsrÑhjÈh"h#h$h8h&}rÒ(h(]h)]h*]h+]h.]uh0M¥h1hh2]rÓh;XDeleting DocumentsrÔ…rÕ}rÖ(hjÑhjÏubaubh?)r×}rØ(hX)It is also possible to delete documents::rÙhjÈh"h#h$hBh&}rÚ(h(]h)]h*]h+]h.]uh0M§h1hh2]rÛh;X(It is also possible to delete documents:rÜ…rÝ}rÞ(hX(It is also possible to delete documents:hj×ubaubh~)rß}rà(hX>>> import time >>> from datetime import datetime >>> doc_service = domain.get_document_service() >>> # Again we'll cheat and use the current epoch time as our version number >>> doc_service.delete(4, int(time.mktime(datetime.utcnow().timetuple()))) >>> doc_service.commit()hjÈh"h#h$hh&}rá(hƒh„h+]h*]h(]h)]h.]uh0M©h1hh2]râh;X>>> import time >>> from datetime import datetime >>> doc_service = domain.get_document_service() >>> # Again we'll cheat and use the current epoch time as our version number >>> doc_service.delete(4, int(time.mktime(datetime.utcnow().timetuple()))) >>> doc_service.commit()rã…rä}rå(hUhjßubaubeubeubh"h#h$h%h&}ræ(h(]rçj^ah)]h*]h+]rèUid1réah.]uh0Mh1hh2]rê(h4)rë}rì(hX,Viewing and Adjusting Stopwords for a Domainríhhh"h#h$h8h&}rî(h(]h)]h*]h+]h.]uh0Mh1hh2]rïh;X,Viewing and Adjusting Stopwords for a Domainrð…rñ}rò(hjíhjëubaubh?)ró}rô(hXÜYou can configure synonyms for terms that appear in the data you are searching. That way, if a user searches for the synonym rather than the indexed term, the results will include documents that contain the indexed term.rõhhh"h#h$hBh&}rö(h(]h)]h*]h+]h.]uh0Mƒh1hh2]r÷h;XÜYou can configure synonyms for terms that appear in the data you are searching. That way, if a user searches for the synonym rather than the indexed term, the results will include documents that contain the indexed term.rø…rù}rú(hjõhjóubaubh?)rû}rü(hXpIf you want two terms to match the same documents, you must define them as synonyms of each other. For example::hhh"h#h$hBh&}rý(h(]h)]h*]h+]h.]uh0Mˆh1hh2]rþh;XoIf you want two terms to match the same documents, you must define them as synonyms of each other. For example:rÿ…r}r(hXoIf you want two terms to match the same documents, you must define them as synonyms of each other. For example:hjûubaubh~)r}r(hXcat, feline feline, cathhh"h#h$hh&}r(hƒh„h+]h*]h(]h)]h.]uh0M‹h1hh2]rh;Xcat, feline feline, catr…r}r(hUhjubaubh?)r }r (hXŽTo view the synonyms currently defined for your domain, use the :py:meth:`get_synonyms ` method::hhh"h#h$hBh&}r (h(]h)]h*]h+]h.]uh0MŽh1hh2]r (h;X@To view the synonyms currently defined for your domain, use the r …r}r(hX@To view the synonyms currently defined for your domain, use the hj ubj2)r}r(hXE:py:meth:`get_synonyms `rhj h"h#h$j6h&}r(UreftypeXmethj8‰j9X+boto.cloudsearch.domain.Domain.get_synonymsU refdomainXpyrh+]h*]U refexplicitˆh(]h)]h.]j;j<j=Nj>Nuh0MŽh2]rj@)r}r(hjh&}r(h(]h)]r(jEjXpy-methreh*]h+]h.]uhjh2]rh;X get_synonymsr…r}r(hUhjubah$jKubaubh;X method:r…r }r!(hX method:hj ubeubh~)r"}r#(hXG>>> synonyms = domain.get_synonyms() >>> synonyms {u'synonyms': {}} >>>hhh"h#h$hh&}r$(hƒh„h+]h*]h(]h)]h.]uh0M‘h1hh2]r%h;XG>>> synonyms = domain.get_synonyms() >>> synonyms {u'synonyms': {}} >>>r&…r'}r((hUhj"ubaubh?)r)}r*(hXcYou can define new synonyms by adding new term:synonyms entries to the synonyms dictionary object::hhh"h#h$hBh&}r+(h(]h)]h*]h+]h.]uh0M–h1hh2]r,h;XbYou can define new synonyms by adding new term:synonyms entries to the synonyms dictionary object:r-…r.}r/(hXbYou can define new synonyms by adding new term:synonyms entries to the synonyms dictionary object:hj)ubaubh~)r0}r1(hXl>>> synonyms['synonyms']['cat'] = ['feline', 'kitten'] >>> synonyms['synonyms']['dog'] = ['canine', 'puppy']hhh"h#h$hh&}r2(hƒh„h+]h*]h(]h)]h.]uh0M™h1hh2]r3h;Xl>>> synonyms['synonyms']['cat'] = ['feline', 'kitten'] >>> synonyms['synonyms']['dog'] = ['canine', 'puppy']r4…r5}r6(hUhj0ubaubh?)r7}r8(hXgTo save the changes, use the :py:meth:`save ` method::hhh"h#h$hBh&}r9(h(]h)]h*]h+]h.]uh0Mœh1hh2]r:(h;XTo save the changes, use the r;…r<}r=(hXTo save the changes, use the hj7ubj2)r>}r?(hXA:py:meth:`save `r@hj7h"h#h$j6h&}rA(UreftypeXmethj8‰j9X/boto.cloudsearch.optionstatus.OptionStatus.saveU refdomainXpyrBh+]h*]U refexplicitˆh(]h)]h.]j;j<j=Nj>Nuh0Mœh2]rCj@)rD}rE(hj@h&}rF(h(]h)]rG(jEjBXpy-methrHeh*]h+]h.]uhj>h2]rIh;XsaverJ…rK}rL(hUhjDubah$jKubaubh;X method:rM…rN}rO(hX method:hj7ubeubh~)rP}rQ(hX>>> synonyms.save()hhh"h#h$hh&}rR(hƒh„h+]h*]h(]h)]h.]uh0MŸh1hh2]rSh;X>>> synonyms.save()rT…rU}rV(hUhjPubaubh?)rW}rX(hXThe synonyms object has similar attributes defined above for stemming that provide additional information about the stopwords in your domain.rYhhh"h#h$hBh&}rZ(h(]h)]h*]h+]h.]uh0M¡h1hh2]r[h;XThe synonyms object has similar attributes defined above for stemming that provide additional information about the stopwords in your domain.r\…r]}r^(hjYhjWubaubeubh"h#h$Usystem_messager_h&}r`(h(]UlevelKh+]h*]rajéaUsourceh#h)]h.]UlineMUtypeUINFOrbuh0Mh1hh2]rch?)rd}re(hUh&}rf(h(]h)]h*]h+]h.]uhhh2]rgh;XODuplicate implicit target name: "viewing and adjusting stopwords for a domain".rh…ri}rj(hUhjdubah$hBubaubaUcurrent_sourcerkNU decorationrlNUautofootnote_startrmKUnameidsrn}ro(hj­hjÊhjõh hch hœh jh híh h]hjJhjÌhNhjehh-uh2]rp(cdocutils.nodes comment rq)rr}rs(hXcloudsearch_tut:hhh"h#h$Ucommentrth&}ru(hƒh„h+]h*]h(]h)]h.]uh0Kh1hh2]rvh;Xcloudsearch_tut:rw…rx}ry(hUhjrubaubh ehUU transformerrzNU footnote_refsr{}r|Urefnamesr}}r~X cloudsearch]rhIasUsymbol_footnotesr€]rUautofootnote_refsr‚]rƒUsymbol_footnote_refsr„]r…U citationsr†]r‡h1hU current_linerˆNUtransform_messagesr‰]rŠUreporterr‹NUid_startrŒKU autofootnotesr]rŽU citation_refsr}rUindirect_targetsr‘]r’Usettingsr“(cdocutils.frontend Values r”or•}r–(Ufootnote_backlinksr—KUrecord_dependenciesr˜NU rfc_base_urlr™Uhttp://tools.ietf.org/html/ršU tracebackr›ˆUpep_referencesrœNUstrip_commentsrNU toc_backlinksržUentryrŸU language_coder Uenr¡U datestampr¢NU report_levelr£KU _destinationr¤NU halt_levelr¥KU strip_classesr¦Nh8NUerror_encoding_error_handlerr§Ubackslashreplacer¨Udebugr©NUembed_stylesheetrª‰Uoutput_encoding_error_handlerr«Ustrictr¬U sectnum_xformr­KUdump_transformsr®NU docinfo_xformr¯KUwarning_streamr°NUpep_file_url_templater±Upep-%04dr²Uexit_status_levelr³KUconfigr´NUstrict_visitorrµNUcloak_email_addressesr¶ˆUtrim_footnote_reference_spacer·‰Uenvr¸NUdump_pseudo_xmlr¹NUexpose_internalsrºNUsectsubtitle_xformr»‰U source_linkr¼NUrfc_referencesr½NUoutput_encodingr¾Uutf-8r¿U source_urlrÀNUinput_encodingrÁU utf-8-sigrÂU_disable_configrÃNU id_prefixrÄUU tab_widthrÅKUerror_encodingrÆUUTF-8rÇU_sourcerÈh#Ugettext_compactrɈU generatorrÊNUdump_internalsrËNU smart_quotesr̉U pep_base_urlrÍUhttp://www.python.org/dev/peps/rÎUsyntax_highlightrÏUlongrÐUinput_encoding_error_handlerrÑj¬Uauto_id_prefixrÒUidrÓUdoctitle_xformrÔ‰Ustrip_elements_with_classesrÕNU _config_filesrÖ]Ufile_insertion_enabledr׈U raw_enabledrØKU dump_settingsrÙNubUsymbol_footnote_startrÚKUidsrÛ}rÜ(híhéjJjFjejajÌjÈhœh˜hch_h-h h]hXj`jZjÊjÆjõjñjéhj­j©jjuUsubstitution_namesrÝ}rÞh$h1h&}rß(h(]h+]h*]Usourceh#h)]h.]uU footnotesrà]ráUrefidsrâ}rãub.