sphinx.html 987 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530
  1. <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Sphinx 2.2.7-dev reference manual</title><meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
  2. <style type="text/css">pre.programlisting { background-color: #f0f0f0; padding: 0.5em; margin-left: 2em; margin-right: 2em; }</style>
  3. </head>
  4. <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div lang="en" class="book" title="Sphinx 2.2.7-dev reference manual"><div class="titlepage"><div><div><h1 class="title"><a name="idp20034560"></a>Sphinx 2.2.7-dev reference manual</h1></div>
  5. <div><h2 class="subtitle">Free open-source SQL full-text search engine</h2></div>
  6. <div><p class="copyright">Copyright &copy; 2001-2014 Andrew Aksyonoff</p></div>
  7. <div><p class="copyright">Copyright &copy; 2008-2014 Sphinx Technologies Inc, <a class="ulink" href="http://sphinxsearch.com" target="_top">http://sphinxsearch.com</a></p></div></div>
  8. <hr></div>
  9. <div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter"><a href="#intro">1. Introduction</a></span></dt>
  10. <dd><dl><dt><span class="sect1"><a href="#about">1.1. About</a></span></dt>
  11. <dt><span class="sect1"><a href="#features">1.2. Sphinx features</a></span></dt>
  12. <dt><span class="sect1"><a href="#getting">1.3. Where to get Sphinx</a></span></dt>
  13. <dt><span class="sect1"><a href="#license">1.4. License</a></span></dt>
  14. <dt><span class="sect1"><a href="#credits">1.5. Credits</a></span></dt>
  15. <dt><span class="sect1"><a href="#history">1.6. History</a></span></dt>
  16. </dl></dd><dt><span class="chapter"><a href="#installation">2. Installation</a></span></dt>
  17. <dd><dl><dt><span class="sect1"><a href="#supported-system">2.1. Supported systems</a></span></dt>
  18. <dt><span class="sect1"><a href="#compiling-from-source">2.2. Compiling Sphinx from source</a></span></dt>
  19. <dd><dl><dt><span class="sect2"><a href="#required-tools">2.2.1. Required tools</a></span></dt>
  20. <dt><span class="sect2"><a href="#compiling-source-linux">2.2.2. Compiling on Linux</a></span></dt>
  21. <dt><span class="sect2"><a href="#compiling-source-problems">2.2.3. Known compilation issues</a></span></dt>
  22. </dl></dd><dt><span class="sect1"><a href="#installing-debian">2.3. Installing Sphinx packages on Debian and Ubuntu</a></span></dt>
  23. <dt><span class="sect1"><a href="#installing-redhat">2.4. Installing Sphinx packages on RedHat and CentOS</a></span></dt>
  24. <dt><span class="sect1"><a href="#installing-windows">2.5. Installing Sphinx on Windows</a></span></dt>
  25. <dt><span class="sect1"><a href="#sphinx-deprecations-defaults">2.6. Sphinx deprecations and changes in default configuration</a></span></dt>
  26. <dt><span class="sect1"><a href="#quick-tour">2.7. Quick Sphinx usage tour</a></span></dt>
  27. </dl></dd><dt><span class="chapter"><a href="#indexing">3. Indexing</a></span></dt>
  28. <dd><dl><dt><span class="sect1"><a href="#sources">3.1. Data sources</a></span></dt>
  29. <dt><span class="sect1"><a href="#fields">3.2. Full-text fields</a></span></dt>
  30. <dt><span class="sect1"><a href="#attributes">3.3. Attributes</a></span></dt>
  31. <dt><span class="sect1"><a href="#mva">3.4. MVA (multi-valued attributes)</a></span></dt>
  32. <dt><span class="sect1"><a href="#indexes">3.5. Indexes</a></span></dt>
  33. <dt><span class="sect1"><a href="#data-restrictions">3.6. Restrictions on the source data</a></span></dt>
  34. <dt><span class="sect1"><a href="#charsets">3.7. Charsets, case folding, translation tables, and replacement rules</a></span></dt>
  35. <dt><span class="sect1"><a href="#sql">3.8. SQL data sources (MySQL, PostgreSQL)</a></span></dt>
  36. <dt><span class="sect1"><a href="#xmlpipe2">3.9. xmlpipe2 data source</a></span></dt>
  37. <dt><span class="sect1"><a href="#tsvpipe">3.10. tsvpipe (Tab Separated Values) data source</a></span></dt>
  38. <dt><span class="sect1"><a href="#live-updates">3.11. Live index updates</a></span></dt>
  39. <dt><span class="sect1"><a href="#delta-updates">3.12. Delta index updates</a></span></dt>
  40. <dt><span class="sect1"><a href="#index-merging">3.13. Index merging</a></span></dt>
  41. </dl></dd><dt><span class="chapter"><a href="#rt-indexes">4. Real-time indexes</a></span></dt>
  42. <dd><dl><dt><span class="sect1"><a href="#rt-overview">4.1. RT indexes overview</a></span></dt>
  43. <dt><span class="sect1"><a href="#rt-caveats">4.2. Known caveats with RT indexes</a></span></dt>
  44. <dt><span class="sect1"><a href="#rt-internals">4.3. RT index internals</a></span></dt>
  45. <dt><span class="sect1"><a href="#rt-binlog">4.4. Binary logging</a></span></dt>
  46. </dl></dd><dt><span class="chapter"><a href="#searching">5. Searching</a></span></dt>
  47. <dd><dl><dt><span class="sect1"><a href="#matching-modes">5.1. Matching modes</a></span></dt>
  48. <dt><span class="sect1"><a href="#boolean-syntax">5.2. Boolean query syntax</a></span></dt>
  49. <dt><span class="sect1"><a href="#extended-syntax">5.3. Extended query syntax</a></span></dt>
  50. <dt><span class="sect1"><a href="#weighting">5.4. Search results ranking</a></span></dt>
  51. <dd><dl><dt><span class="sect2"><a href="#ranking-overview">5.4.1. Ranking overview</a></span></dt>
  52. <dt><span class="sect2"><a href="#builtin-rankers">5.4.2. Available built-in rankers</a></span></dt>
  53. <dt><span class="sect2"><a href="#expression-ranker">5.4.3. Expression based ranker (SPH_RANK_EXPR)</a></span></dt>
  54. <dt><span class="sect2"><a href="#ranking-factors">5.4.4. Quick summary of the ranking factors</a></span></dt>
  55. <dt><span class="sect2"><a href="#document-factors">5.4.5. Document-level ranking factors</a></span></dt>
  56. <dt><span class="sect2"><a href="#field-factors">5.4.6. Field-level ranking factors</a></span></dt>
  57. <dt><span class="sect2"><a href="#factor-aggr-functions">5.4.7. Ranking factor aggregation functions</a></span></dt>
  58. <dt><span class="sect2"><a href="#formulas-for-builtin-rankers">5.4.8. Formula expressions for all the built-in rankers</a></span></dt>
  59. </dl></dd><dt><span class="sect1"><a href="#expressions">5.5. Expressions, functions, and operators</a></span></dt>
  60. <dd><dl><dt><span class="sect2"><a href="#operators">5.5.1. Operators</a></span></dt>
  61. <dt><span class="sect2"><a href="#numeric-functions">5.5.2. Numeric functions</a></span></dt>
  62. <dt><span class="sect2"><a href="#date-time-functions">5.5.3. Date and time functions</a></span></dt>
  63. <dt><span class="sect2"><a href="#type-conversion-functions">5.5.4. Type conversion functions</a></span></dt>
  64. <dt><span class="sect2"><a href="#comparison-functions">5.5.5. Comparison functions</a></span></dt>
  65. <dt><span class="sect2"><a href="#misc-functions">5.5.6. Miscellaneous functions</a></span></dt>
  66. </dl></dd><dt><span class="sect1"><a href="#sorting-modes">5.6. Sorting modes</a></span></dt>
  67. <dt><span class="sect1"><a href="#clustering">5.7. Grouping (clustering) search results </a></span></dt>
  68. <dt><span class="sect1"><a href="#distributed">5.8. Distributed searching</a></span></dt>
  69. <dt><span class="sect1"><a href="#query-log-format">5.9. <code class="filename">searchd</code> query log formats</a></span></dt>
  70. <dd><dl><dt><span class="sect2"><a href="#plain-log-format">5.9.1. Plain log format</a></span></dt>
  71. <dt><span class="sect2"><a href="#sphinxql-log-format">5.9.2. SphinxQL log format</a></span></dt>
  72. </dl></dd><dt><span class="sect1"><a href="#sphinxql">5.10. MySQL protocol support and SphinxQL</a></span></dt>
  73. <dt><span class="sect1"><a href="#multi-queries">5.11. Multi-queries</a></span></dt>
  74. <dt><span class="sect1"><a href="#collations">5.12. Collations</a></span></dt>
  75. </dl></dd><dt><span class="chapter"><a href="#extending-sphinx">6. Extending Sphinx</a></span></dt>
  76. <dd><dl><dt><span class="sect1"><a href="#sphinx-udfs">6.1. Sphinx UDFs (User Defined Functions)</a></span></dt>
  77. <dt><span class="sect1"><a href="#sphinx-plugins">6.2. Sphinx plugins</a></span></dt>
  78. <dt><span class="sect1"><a href="#ranker-plugins">6.3. Ranker plugins</a></span></dt>
  79. </dl></dd><dt><span class="chapter"><a href="#command-line-tools">7. Command line tools reference</a></span></dt>
  80. <dd><dl><dt><span class="sect1"><a href="#ref-indexer">7.1. <code class="filename">indexer</code> command reference</a></span></dt>
  81. <dt><span class="sect1"><a href="#ref-searchd">7.2. <code class="filename">searchd</code> command reference</a></span></dt>
  82. <dt><span class="sect1"><a href="#ref-spelldump">7.3. <code class="filename">spelldump</code> command reference</a></span></dt>
  83. <dt><span class="sect1"><a href="#ref-indextool">7.4. <code class="filename">indextool</code> command reference</a></span></dt>
  84. <dt><span class="sect1"><a href="#ref-wordbreaker">7.5. <code class="filename">wordbreaker</code> command reference</a></span></dt>
  85. </dl></dd><dt><span class="chapter"><a href="#sphinxql-reference">8. SphinxQL reference</a></span></dt>
  86. <dd><dl><dt><span class="sect1"><a href="#sphinxql-select">8.1. SELECT syntax</a></span></dt>
  87. <dt><span class="sect1"><a href="#sphinxql-select-sysvar">8.2. SELECT @@system_variable syntax</a></span></dt>
  88. <dt><span class="sect1"><a href="#sphinxql-show-meta">8.3. SHOW META syntax</a></span></dt>
  89. <dt><span class="sect1"><a href="#sphinxql-show-warnings">8.4. SHOW WARNINGS syntax</a></span></dt>
  90. <dt><span class="sect1"><a href="#sphinxql-show-status">8.5. SHOW STATUS syntax</a></span></dt>
  91. <dt><span class="sect1"><a href="#sphinxql-insert">8.6. INSERT and REPLACE syntax</a></span></dt>
  92. <dt><span class="sect1"><a href="#sphinxql-replace">8.7. REPLACE syntax</a></span></dt>
  93. <dt><span class="sect1"><a href="#sphinxql-delete">8.8. DELETE syntax</a></span></dt>
  94. <dt><span class="sect1"><a href="#sphinxql-set">8.9. SET syntax</a></span></dt>
  95. <dt><span class="sect1"><a href="#sphinxql-set-transaction">8.10. SET TRANSACTION syntax</a></span></dt>
  96. <dt><span class="sect1"><a href="#sphinxql-commit">8.11. BEGIN, COMMIT, and ROLLBACK syntax</a></span></dt>
  97. <dt><span class="sect1"><a href="#sphinxql-begin">8.12. BEGIN syntax</a></span></dt>
  98. <dt><span class="sect1"><a href="#sphinxql-rollback">8.13. ROLLBACK syntax</a></span></dt>
  99. <dt><span class="sect1"><a href="#sphinxql-call-snippets">8.14. CALL SNIPPETS syntax</a></span></dt>
  100. <dt><span class="sect1"><a href="#sphinxql-call-keywords">8.15. CALL KEYWORDS syntax</a></span></dt>
  101. <dt><span class="sect1"><a href="#sphinxql-show-tables">8.16. SHOW TABLES syntax</a></span></dt>
  102. <dt><span class="sect1"><a href="#sphinxql-describe">8.17. DESCRIBE syntax</a></span></dt>
  103. <dt><span class="sect1"><a href="#sphinxql-create-function">8.18. CREATE FUNCTION syntax</a></span></dt>
  104. <dt><span class="sect1"><a href="#sphinxql-drop-function">8.19. DROP FUNCTION syntax</a></span></dt>
  105. <dt><span class="sect1"><a href="#sphinxql-show-variables">8.20. SHOW VARIABLES syntax</a></span></dt>
  106. <dt><span class="sect1"><a href="#sphinxql-show-collation">8.21. SHOW COLLATION syntax</a></span></dt>
  107. <dt><span class="sect1"><a href="#sphinxql-show-character-set">8.22. SHOW CHARACTER SET syntax</a></span></dt>
  108. <dt><span class="sect1"><a href="#sphinxql-update">8.23. UPDATE syntax</a></span></dt>
  109. <dt><span class="sect1"><a href="#sphinxql-attach">8.24. ALTER syntax</a></span></dt>
  110. <dt><span class="sect1"><a href="#sphinxql-attach-index">8.25. ATTACH INDEX syntax</a></span></dt>
  111. <dt><span class="sect1"><a href="#sphinxql-flush-rtindex">8.26. FLUSH RTINDEX syntax</a></span></dt>
  112. <dt><span class="sect1"><a href="#sphinxql-flush-ramchunk">8.27. FLUSH RAMCHUNK syntax</a></span></dt>
  113. <dt><span class="sect1"><a href="#sphinxql-truncate-rtindex">8.28. TRUNCATE RTINDEX syntax</a></span></dt>
  114. <dt><span class="sect1"><a href="#sphinxql-show-agent-status">8.29. SHOW AGENT STATUS</a></span></dt>
  115. <dt><span class="sect1"><a href="#sphinxql-show-profile">8.30. SHOW PROFILE syntax</a></span></dt>
  116. <dt><span class="sect1"><a href="#sphinxql-show-index-status">8.31. SHOW INDEX STATUS syntax</a></span></dt>
  117. <dt><span class="sect1"><a href="#sphinxql-show-index-settings">8.32. SHOW INDEX SETTINGS syntax</a></span></dt>
  118. <dt><span class="sect1"><a href="#sphinxql-optimize-index">8.33. OPTIMIZE INDEX syntax</a></span></dt>
  119. <dt><span class="sect1"><a href="#sphinxql-show-plan">8.34. SHOW PLAN syntax</a></span></dt>
  120. <dt><span class="sect1"><a href="#sphinxql-show-databases">8.35. SHOW DATABASES syntax</a></span></dt>
  121. <dt><span class="sect1"><a href="#sphinxql-create-plugin">8.36. CREATE PLUGIN syntax</a></span></dt>
  122. <dt><span class="sect1"><a href="#sphinxql-drop-plugin">8.37. DROP PLUGIN syntax</a></span></dt>
  123. <dt><span class="sect1"><a href="#sphinxql-show-plugins">8.38. SHOW PLUGINS syntax</a></span></dt>
  124. <dt><span class="sect1"><a href="#sphinxql-threads">8.39. SHOW THREADS syntax</a></span></dt>
  125. <dt><span class="sect1"><a href="#sphinxql-multi-queries">8.40. Multi-statement queries</a></span></dt>
  126. <dt><span class="sect1"><a href="#sphinxql-comment-syntax">8.41. Comment syntax</a></span></dt>
  127. <dt><span class="sect1"><a href="#sphinxql-reserved-keywords">8.42. List of SphinxQL reserved keywords</a></span></dt>
  128. <dt><span class="sect1"><a href="#sphinxql-upgrading-magics">8.43. SphinxQL upgrade notes, version 2.0.1-beta</a></span></dt>
  129. </dl></dd><dt><span class="chapter"><a href="#api-reference">9. API reference</a></span></dt>
  130. <dd><dl><dt><span class="sect1"><a href="#api-funcgroup-general">9.1. General API functions</a></span></dt>
  131. <dd><dl><dt><span class="sect2"><a href="#api-func-getlasterror">9.1.1. GetLastError</a></span></dt>
  132. <dt><span class="sect2"><a href="#api-func-getlastwarning">9.1.2. GetLastWarning</a></span></dt>
  133. <dt><span class="sect2"><a href="#api-func-setserver">9.1.3. SetServer</a></span></dt>
  134. <dt><span class="sect2"><a href="#api-func-setretries">9.1.4. SetRetries</a></span></dt>
  135. <dt><span class="sect2"><a href="#api-func-setconnecttimeout">9.1.5. SetConnectTimeout</a></span></dt>
  136. <dt><span class="sect2"><a href="#api-func-setarrayresult">9.1.6. SetArrayResult</a></span></dt>
  137. <dt><span class="sect2"><a href="#api-func-isconnecterror">9.1.7. IsConnectError</a></span></dt>
  138. </dl></dd><dt><span class="sect1"><a href="#api-funcgroup-general-query-settings">9.2. General query settings</a></span></dt>
  139. <dd><dl><dt><span class="sect2"><a href="#api-func-setlimits">9.2.1. SetLimits</a></span></dt>
  140. <dt><span class="sect2"><a href="#api-func-setmaxquerytime">9.2.2. SetMaxQueryTime</a></span></dt>
  141. <dt><span class="sect2"><a href="#api-func-setoverride">9.2.3. SetOverride</a></span></dt>
  142. <dt><span class="sect2"><a href="#api-func-setselect">9.2.4. SetSelect</a></span></dt>
  143. </dl></dd><dt><span class="sect1"><a href="#api-funcgroup-fulltext-query-settings">9.3. Full-text search query settings</a></span></dt>
  144. <dd><dl><dt><span class="sect2"><a href="#api-func-setmatchmode">9.3.1. SetMatchMode</a></span></dt>
  145. <dt><span class="sect2"><a href="#api-func-setrankingmode">9.3.2. SetRankingMode</a></span></dt>
  146. <dt><span class="sect2"><a href="#api-func-setsortmode">9.3.3. SetSortMode</a></span></dt>
  147. <dt><span class="sect2"><a href="#api-func-setweights">9.3.4. SetWeights</a></span></dt>
  148. <dt><span class="sect2"><a href="#api-func-setfieldweights">9.3.5. SetFieldWeights</a></span></dt>
  149. <dt><span class="sect2"><a href="#api-func-setindexweights">9.3.6. SetIndexWeights</a></span></dt>
  150. </dl></dd><dt><span class="sect1"><a href="#api-funcgroup-filtering">9.4. Result set filtering settings</a></span></dt>
  151. <dd><dl><dt><span class="sect2"><a href="#api-func-setidrange">9.4.1. SetIDRange</a></span></dt>
  152. <dt><span class="sect2"><a href="#api-func-setfilter">9.4.2. SetFilter</a></span></dt>
  153. <dt><span class="sect2"><a href="#api-func-setfilterrange">9.4.3. SetFilterRange</a></span></dt>
  154. <dt><span class="sect2"><a href="#api-func-setfilterfloatrange">9.4.4. SetFilterFloatRange</a></span></dt>
  155. <dt><span class="sect2"><a href="#api-func-setgeoanchor">9.4.5. SetGeoAnchor</a></span></dt>
  156. <dt><span class="sect2"><a href="#api-func-setfilterstring">9.4.6. SetFilterString</a></span></dt>
  157. </dl></dd><dt><span class="sect1"><a href="#api-funcgroup-groupby">9.5. GROUP BY settings</a></span></dt>
  158. <dd><dl><dt><span class="sect2"><a href="#api-func-setgroupby">9.5.1. SetGroupBy</a></span></dt>
  159. <dt><span class="sect2"><a href="#api-func-setgroupdistinct">9.5.2. SetGroupDistinct</a></span></dt>
  160. </dl></dd><dt><span class="sect1"><a href="#api-funcgroup-querying">9.6. Querying</a></span></dt>
  161. <dd><dl><dt><span class="sect2"><a href="#api-func-query">9.6.1. Query</a></span></dt>
  162. <dt><span class="sect2"><a href="#api-func-addquery">9.6.2. AddQuery</a></span></dt>
  163. <dt><span class="sect2"><a href="#api-func-runqueries">9.6.3. RunQueries</a></span></dt>
  164. <dt><span class="sect2"><a href="#api-func-resetfilters">9.6.4. ResetFilters</a></span></dt>
  165. <dt><span class="sect2"><a href="#api-func-resetgroupby">9.6.5. ResetGroupBy</a></span></dt>
  166. </dl></dd><dt><span class="sect1"><a href="#api-funcgroup-additional-functionality">9.7. Additional functionality</a></span></dt>
  167. <dd><dl><dt><span class="sect2"><a href="#api-func-buildexcerpts">9.7.1. BuildExcerpts</a></span></dt>
  168. <dt><span class="sect2"><a href="#api-func-updateatttributes">9.7.2. UpdateAttributes</a></span></dt>
  169. <dt><span class="sect2"><a href="#api-func-buildkeywords">9.7.3. BuildKeywords</a></span></dt>
  170. <dt><span class="sect2"><a href="#api-func-escapestring">9.7.4. EscapeString</a></span></dt>
  171. <dt><span class="sect2"><a href="#api-func-status">9.7.5. Status</a></span></dt>
  172. <dt><span class="sect2"><a href="#api-func-flushattributes">9.7.6. FlushAttributes</a></span></dt>
  173. </dl></dd><dt><span class="sect1"><a href="#api-funcgroup-pconn">9.8. Persistent connections</a></span></dt>
  174. <dd><dl><dt><span class="sect2"><a href="#api-func-open">9.8.1. Open</a></span></dt>
  175. <dt><span class="sect2"><a href="#api-func-close">9.8.2. Close</a></span></dt>
  176. </dl></dd></dl></dd><dt><span class="chapter"><a href="#sphinxse">10. MySQL storage engine (SphinxSE)</a></span></dt>
  177. <dd><dl><dt><span class="sect1"><a href="#sphinxse-overview">10.1. SphinxSE overview</a></span></dt>
  178. <dt><span class="sect1"><a href="#sphinxse-installing">10.2. Installing SphinxSE</a></span></dt>
  179. <dd><dl><dt><span class="sect2"><a href="#sphinxse-mysql50">10.2.1. Compiling MySQL 5.0.x with SphinxSE</a></span></dt>
  180. <dt><span class="sect2"><a href="#sphinxse-mysql51">10.2.2. Compiling MySQL 5.1.x with SphinxSE</a></span></dt>
  181. <dt><span class="sect2"><a href="#sphinxse-checking">10.2.3. Checking SphinxSE installation</a></span></dt>
  182. </dl></dd><dt><span class="sect1"><a href="#sphinxse-using">10.3. Using SphinxSE</a></span></dt>
  183. <dt><span class="sect1"><a href="#sphinxse-snippets">10.4. Building snippets (excerpts) via MySQL</a></span></dt>
  184. </dl></dd><dt><span class="chapter"><a href="#reporting-bugs">11. Reporting bugs</a></span></dt>
  185. <dt><span class="chapter"><a href="#conf-reference">12. <code class="filename">sphinx.conf</code> options reference</a></span></dt>
  186. <dd><dl><dt><span class="sect1"><a href="#confgroup-source">12.1. Data source configuration options</a></span></dt>
  187. <dd><dl><dt><span class="sect2"><a href="#conf-source-type">12.1.1. type</a></span></dt>
  188. <dt><span class="sect2"><a href="#conf-sql-host">12.1.2. sql_host</a></span></dt>
  189. <dt><span class="sect2"><a href="#conf-sql-port">12.1.3. sql_port</a></span></dt>
  190. <dt><span class="sect2"><a href="#conf-sql-user">12.1.4. sql_user</a></span></dt>
  191. <dt><span class="sect2"><a href="#conf-sql-pass">12.1.5. sql_pass</a></span></dt>
  192. <dt><span class="sect2"><a href="#conf-sql-db">12.1.6. sql_db</a></span></dt>
  193. <dt><span class="sect2"><a href="#conf-sql-sock">12.1.7. sql_sock</a></span></dt>
  194. <dt><span class="sect2"><a href="#conf-mysql-connect-flags">12.1.8. mysql_connect_flags</a></span></dt>
  195. <dt><span class="sect2"><a href="#conf-mysql-ssl">12.1.9. mysql_ssl_cert, mysql_ssl_key, mysql_ssl_ca</a></span></dt>
  196. <dt><span class="sect2"><a href="#conf-odbc-dsn">12.1.10. odbc_dsn</a></span></dt>
  197. <dt><span class="sect2"><a href="#conf-sql-query-pre">12.1.11. sql_query_pre</a></span></dt>
  198. <dt><span class="sect2"><a href="#conf-sql-query">12.1.12. sql_query</a></span></dt>
  199. <dt><span class="sect2"><a href="#conf-sql-joined-field">12.1.13. sql_joined_field</a></span></dt>
  200. <dt><span class="sect2"><a href="#conf-sql-query-range">12.1.14. sql_query_range</a></span></dt>
  201. <dt><span class="sect2"><a href="#conf-sql-range-step">12.1.15. sql_range_step</a></span></dt>
  202. <dt><span class="sect2"><a href="#conf-sql-query-killlist">12.1.16. sql_query_killlist</a></span></dt>
  203. <dt><span class="sect2"><a href="#conf-sql-attr-uint">12.1.17. sql_attr_uint</a></span></dt>
  204. <dt><span class="sect2"><a href="#conf-sql-attr-bool">12.1.18. sql_attr_bool</a></span></dt>
  205. <dt><span class="sect2"><a href="#conf-sql-attr-bigint">12.1.19. sql_attr_bigint</a></span></dt>
  206. <dt><span class="sect2"><a href="#conf-sql-attr-timestamp">12.1.20. sql_attr_timestamp</a></span></dt>
  207. <dt><span class="sect2"><a href="#conf-sql-attr-float">12.1.21. sql_attr_float</a></span></dt>
  208. <dt><span class="sect2"><a href="#conf-sql-attr-multi">12.1.22. sql_attr_multi</a></span></dt>
  209. <dt><span class="sect2"><a href="#conf-sql-attr-string">12.1.23. sql_attr_string</a></span></dt>
  210. <dt><span class="sect2"><a href="#conf-sql-attr-json">12.1.24. sql_attr_json</a></span></dt>
  211. <dt><span class="sect2"><a href="#conf-sql-column-buffers">12.1.25. sql_column_buffers</a></span></dt>
  212. <dt><span class="sect2"><a href="#conf-sql-field-string">12.1.26. sql_field_string</a></span></dt>
  213. <dt><span class="sect2"><a href="#conf-sql-file-field">12.1.27. sql_file_field</a></span></dt>
  214. <dt><span class="sect2"><a href="#conf-sql-query-post">12.1.28. sql_query_post</a></span></dt>
  215. <dt><span class="sect2"><a href="#conf-sql-query-post-index">12.1.29. sql_query_post_index</a></span></dt>
  216. <dt><span class="sect2"><a href="#conf-sql-ranged-throttle">12.1.30. sql_ranged_throttle</a></span></dt>
  217. <dt><span class="sect2"><a href="#conf-xmlpipe-command">12.1.31. xmlpipe_command</a></span></dt>
  218. <dt><span class="sect2"><a href="#conf-xmlpipe-field">12.1.32. xmlpipe_field</a></span></dt>
  219. <dt><span class="sect2"><a href="#conf-xmlpipe-field-string">12.1.33. xmlpipe_field_string</a></span></dt>
  220. <dt><span class="sect2"><a href="#conf-xmlpipe-attr-uint">12.1.34. xmlpipe_attr_uint</a></span></dt>
  221. <dt><span class="sect2"><a href="#conf-xmlpipe-attr-bigint">12.1.35. xmlpipe_attr_bigint</a></span></dt>
  222. <dt><span class="sect2"><a href="#conf-xmlpipe-attr-bool">12.1.36. xmlpipe_attr_bool</a></span></dt>
  223. <dt><span class="sect2"><a href="#conf-xmlpipe-attr-timestamp">12.1.37. xmlpipe_attr_timestamp</a></span></dt>
  224. <dt><span class="sect2"><a href="#conf-xmlpipe-attr-float">12.1.38. xmlpipe_attr_float</a></span></dt>
  225. <dt><span class="sect2"><a href="#conf-xmlpipe-attr-multi">12.1.39. xmlpipe_attr_multi</a></span></dt>
  226. <dt><span class="sect2"><a href="#conf-xmlpipe-attr-multi-64">12.1.40. xmlpipe_attr_multi_64</a></span></dt>
  227. <dt><span class="sect2"><a href="#conf-xmlpipe-attr-string">12.1.41. xmlpipe_attr_string</a></span></dt>
  228. <dt><span class="sect2"><a href="#conf-xmlpipe-attr-json">12.1.42. xmlpipe_attr_json</a></span></dt>
  229. <dt><span class="sect2"><a href="#conf-xmlpipe-fixup-utf8">12.1.43. xmlpipe_fixup_utf8</a></span></dt>
  230. <dt><span class="sect2"><a href="#conf-mssql-winauth">12.1.44. mssql_winauth</a></span></dt>
  231. <dt><span class="sect2"><a href="#conf-unpack-zlib">12.1.45. unpack_zlib</a></span></dt>
  232. <dt><span class="sect2"><a href="#conf-unpack-mysqlcompress">12.1.46. unpack_mysqlcompress</a></span></dt>
  233. <dt><span class="sect2"><a href="#conf-unpack-mysqlcompress-maxsize">12.1.47. unpack_mysqlcompress_maxsize</a></span></dt>
  234. </dl></dd><dt><span class="sect1"><a href="#confgroup-index">12.2. Index configuration options</a></span></dt>
  235. <dd><dl><dt><span class="sect2"><a href="#conf-index-type">12.2.1. type</a></span></dt>
  236. <dt><span class="sect2"><a href="#conf-source">12.2.2. source</a></span></dt>
  237. <dt><span class="sect2"><a href="#conf-path">12.2.3. path</a></span></dt>
  238. <dt><span class="sect2"><a href="#conf-docinfo">12.2.4. docinfo</a></span></dt>
  239. <dt><span class="sect2"><a href="#conf-mlock">12.2.5. mlock</a></span></dt>
  240. <dt><span class="sect2"><a href="#conf-morphology">12.2.6. morphology</a></span></dt>
  241. <dt><span class="sect2"><a href="#conf-dict">12.2.7. dict</a></span></dt>
  242. <dt><span class="sect2"><a href="#conf-index-sp">12.2.8. index_sp</a></span></dt>
  243. <dt><span class="sect2"><a href="#conf-index-zones">12.2.9. index_zones</a></span></dt>
  244. <dt><span class="sect2"><a href="#conf-min-stemming-len">12.2.10. min_stemming_len</a></span></dt>
  245. <dt><span class="sect2"><a href="#conf-stopwords">12.2.11. stopwords</a></span></dt>
  246. <dt><span class="sect2"><a href="#conf-wordforms">12.2.12. wordforms</a></span></dt>
  247. <dt><span class="sect2"><a href="#conf-embedded-limit">12.2.13. embedded_limit</a></span></dt>
  248. <dt><span class="sect2"><a href="#conf-exceptions">12.2.14. exceptions</a></span></dt>
  249. <dt><span class="sect2"><a href="#conf-min-word-len">12.2.15. min_word_len</a></span></dt>
  250. <dt><span class="sect2"><a href="#conf-charset-table">12.2.16. charset_table</a></span></dt>
  251. <dt><span class="sect2"><a href="#conf-ignore-chars">12.2.17. ignore_chars</a></span></dt>
  252. <dt><span class="sect2"><a href="#conf-min-prefix-len">12.2.18. min_prefix_len</a></span></dt>
  253. <dt><span class="sect2"><a href="#conf-min-infix-len">12.2.19. min_infix_len</a></span></dt>
  254. <dt><span class="sect2"><a href="#conf-max-substring-len">12.2.20. max_substring_len</a></span></dt>
  255. <dt><span class="sect2"><a href="#conf-prefix-fields">12.2.21. prefix_fields</a></span></dt>
  256. <dt><span class="sect2"><a href="#conf-infix-fields">12.2.22. infix_fields</a></span></dt>
  257. <dt><span class="sect2"><a href="#conf-ngram-len">12.2.23. ngram_len</a></span></dt>
  258. <dt><span class="sect2"><a href="#conf-ngram-chars">12.2.24. ngram_chars</a></span></dt>
  259. <dt><span class="sect2"><a href="#conf-phrase-boundary">12.2.25. phrase_boundary</a></span></dt>
  260. <dt><span class="sect2"><a href="#conf-phrase-boundary-step">12.2.26. phrase_boundary_step</a></span></dt>
  261. <dt><span class="sect2"><a href="#conf-html-strip">12.2.27. html_strip</a></span></dt>
  262. <dt><span class="sect2"><a href="#conf-html-index-attrs">12.2.28. html_index_attrs</a></span></dt>
  263. <dt><span class="sect2"><a href="#conf-html-remove-elements">12.2.29. html_remove_elements</a></span></dt>
  264. <dt><span class="sect2"><a href="#conf-local">12.2.30. local</a></span></dt>
  265. <dt><span class="sect2"><a href="#conf-agent">12.2.31. agent</a></span></dt>
  266. <dt><span class="sect2"><a href="#conf-agent-persistent">12.2.32. agent_persistent</a></span></dt>
  267. <dt><span class="sect2"><a href="#conf-agent-blackhole">12.2.33. agent_blackhole</a></span></dt>
  268. <dt><span class="sect2"><a href="#conf-agent-connect-timeout">12.2.34. agent_connect_timeout</a></span></dt>
  269. <dt><span class="sect2"><a href="#conf-agent-query-timeout">12.2.35. agent_query_timeout</a></span></dt>
  270. <dt><span class="sect2"><a href="#conf-preopen">12.2.36. preopen</a></span></dt>
  271. <dt><span class="sect2"><a href="#conf-inplace-enable">12.2.37. inplace_enable</a></span></dt>
  272. <dt><span class="sect2"><a href="#conf-inplace-hit-gap">12.2.38. inplace_hit_gap</a></span></dt>
  273. <dt><span class="sect2"><a href="#conf-inplace-docinfo-gap">12.2.39. inplace_docinfo_gap</a></span></dt>
  274. <dt><span class="sect2"><a href="#conf-inplace-reloc-factor">12.2.40. inplace_reloc_factor</a></span></dt>
  275. <dt><span class="sect2"><a href="#conf-inplace-write-factor">12.2.41. inplace_write_factor</a></span></dt>
  276. <dt><span class="sect2"><a href="#conf-index-exact-words">12.2.42. index_exact_words</a></span></dt>
  277. <dt><span class="sect2"><a href="#conf-overshort-step">12.2.43. overshort_step</a></span></dt>
  278. <dt><span class="sect2"><a href="#conf-stopword-step">12.2.44. stopword_step</a></span></dt>
  279. <dt><span class="sect2"><a href="#conf-hitless-words">12.2.45. hitless_words</a></span></dt>
  280. <dt><span class="sect2"><a href="#conf-expand-keywords">12.2.46. expand_keywords</a></span></dt>
  281. <dt><span class="sect2"><a href="#conf-blend-chars">12.2.47. blend_chars</a></span></dt>
  282. <dt><span class="sect2"><a href="#conf-blend-mode">12.2.48. blend_mode</a></span></dt>
  283. <dt><span class="sect2"><a href="#conf-rt-mem-limit">12.2.49. rt_mem_limit</a></span></dt>
  284. <dt><span class="sect2"><a href="#conf-rt-field">12.2.50. rt_field</a></span></dt>
  285. <dt><span class="sect2"><a href="#conf-rt-attr-uint">12.2.51. rt_attr_uint</a></span></dt>
  286. <dt><span class="sect2"><a href="#conf-rt-attr-bool">12.2.52. rt_attr_bool</a></span></dt>
  287. <dt><span class="sect2"><a href="#conf-rt-attr-bigint">12.2.53. rt_attr_bigint</a></span></dt>
  288. <dt><span class="sect2"><a href="#conf-rt-attr-float">12.2.54. rt_attr_float</a></span></dt>
  289. <dt><span class="sect2"><a href="#conf-rt-attr-multi">12.2.55. rt_attr_multi</a></span></dt>
  290. <dt><span class="sect2"><a href="#conf-rt-attr-multi-64">12.2.56. rt_attr_multi_64</a></span></dt>
  291. <dt><span class="sect2"><a href="#conf-rt-attr-timestamp">12.2.57. rt_attr_timestamp</a></span></dt>
  292. <dt><span class="sect2"><a href="#conf-rt-attr-string">12.2.58. rt_attr_string</a></span></dt>
  293. <dt><span class="sect2"><a href="#conf-rt-attr-json">12.2.59. rt_attr_json</a></span></dt>
  294. <dt><span class="sect2"><a href="#conf-ha-strategy">12.2.60. ha_strategy</a></span></dt>
  295. <dt><span class="sect2"><a href="#conf-bigram-freq-words">12.2.61. bigram_freq_words</a></span></dt>
  296. <dt><span class="sect2"><a href="#conf-bigram-index">12.2.62. bigram_index</a></span></dt>
  297. <dt><span class="sect2"><a href="#conf-index-field-lengths">12.2.63. index_field_lengths</a></span></dt>
  298. <dt><span class="sect2"><a href="#conf-regexp-filter">12.2.64. regexp_filter</a></span></dt>
  299. <dt><span class="sect2"><a href="#conf-stopwords-unstemmed">12.2.65. stopwords_unstemmed</a></span></dt>
  300. <dt><span class="sect2"><a href="#conf-global-idf">12.2.66. global_idf</a></span></dt>
  301. <dt><span class="sect2"><a href="#conf-rlp-context">12.2.67. rlp_context</a></span></dt>
  302. <dt><span class="sect2"><a href="#conf-ondisk-attrs">12.2.68. ondisk_attrs</a></span></dt>
  303. </dl></dd><dt><span class="sect1"><a href="#confgroup-indexer">12.3. <code class="filename">indexer</code> program configuration options</a></span></dt>
  304. <dd><dl><dt><span class="sect2"><a href="#conf-mem-limit">12.3.1. mem_limit</a></span></dt>
  305. <dt><span class="sect2"><a href="#conf-max-iops">12.3.2. max_iops</a></span></dt>
  306. <dt><span class="sect2"><a href="#conf-max-iosize">12.3.3. max_iosize</a></span></dt>
  307. <dt><span class="sect2"><a href="#conf-max-xmlpipe2-field">12.3.4. max_xmlpipe2_field</a></span></dt>
  308. <dt><span class="sect2"><a href="#conf-write-buffer">12.3.5. write_buffer</a></span></dt>
  309. <dt><span class="sect2"><a href="#conf-max-file-field-buffer">12.3.6. max_file_field_buffer</a></span></dt>
  310. <dt><span class="sect2"><a href="#conf-on-file-field-error">12.3.7. on_file_field_error</a></span></dt>
  311. <dt><span class="sect2"><a href="#conf-lemmatizer-cache">12.3.8. lemmatizer_cache</a></span></dt>
  312. </dl></dd><dt><span class="sect1"><a href="#confgroup-searchd">12.4. <code class="filename">searchd</code> program configuration options</a></span></dt>
  313. <dd><dl><dt><span class="sect2"><a href="#conf-listen">12.4.1. listen</a></span></dt>
  314. <dt><span class="sect2"><a href="#conf-log">12.4.2. log</a></span></dt>
  315. <dt><span class="sect2"><a href="#conf-query-log">12.4.3. query_log</a></span></dt>
  316. <dt><span class="sect2"><a href="#conf-query-log-format">12.4.4. query_log_format</a></span></dt>
  317. <dt><span class="sect2"><a href="#conf-read-timeout">12.4.5. read_timeout</a></span></dt>
  318. <dt><span class="sect2"><a href="#conf-client-timeout">12.4.6. client_timeout</a></span></dt>
  319. <dt><span class="sect2"><a href="#conf-max-children">12.4.7. max_children</a></span></dt>
  320. <dt><span class="sect2"><a href="#conf-pid-file">12.4.8. pid_file</a></span></dt>
  321. <dt><span class="sect2"><a href="#conf-seamless-rotate">12.4.9. seamless_rotate</a></span></dt>
  322. <dt><span class="sect2"><a href="#conf-preopen-indexes">12.4.10. preopen_indexes</a></span></dt>
  323. <dt><span class="sect2"><a href="#conf-unlink-old">12.4.11. unlink_old</a></span></dt>
  324. <dt><span class="sect2"><a href="#conf-attr-flush-period">12.4.12. attr_flush_period</a></span></dt>
  325. <dt><span class="sect2"><a href="#conf-max-packet-size">12.4.13. max_packet_size</a></span></dt>
  326. <dt><span class="sect2"><a href="#conf-mva-updates-pool">12.4.14. mva_updates_pool</a></span></dt>
  327. <dt><span class="sect2"><a href="#conf-max-filters">12.4.15. max_filters</a></span></dt>
  328. <dt><span class="sect2"><a href="#conf-max-filter-values">12.4.16. max_filter_values</a></span></dt>
  329. <dt><span class="sect2"><a href="#conf-listen-backlog">12.4.17. listen_backlog</a></span></dt>
  330. <dt><span class="sect2"><a href="#conf-read-buffer">12.4.18. read_buffer</a></span></dt>
  331. <dt><span class="sect2"><a href="#conf-read-unhinted">12.4.19. read_unhinted</a></span></dt>
  332. <dt><span class="sect2"><a href="#conf-max-batch-queries">12.4.20. max_batch_queries</a></span></dt>
  333. <dt><span class="sect2"><a href="#conf-subtree-docs-cache">12.4.21. subtree_docs_cache</a></span></dt>
  334. <dt><span class="sect2"><a href="#conf-subtree-hits-cache">12.4.22. subtree_hits_cache</a></span></dt>
  335. <dt><span class="sect2"><a href="#conf-workers">12.4.23. workers</a></span></dt>
  336. <dt><span class="sect2"><a href="#conf-dist-threads">12.4.24. dist_threads</a></span></dt>
  337. <dt><span class="sect2"><a href="#conf-binlog-path">12.4.25. binlog_path</a></span></dt>
  338. <dt><span class="sect2"><a href="#conf-binlog-flush">12.4.26. binlog_flush</a></span></dt>
  339. <dt><span class="sect2"><a href="#conf-binlog-max-log-size">12.4.27. binlog_max_log_size</a></span></dt>
  340. <dt><span class="sect2"><a href="#conf-snippets-file-prefix">12.4.28. snippets_file_prefix</a></span></dt>
  341. <dt><span class="sect2"><a href="#conf-collation-server">12.4.29. collation_server</a></span></dt>
  342. <dt><span class="sect2"><a href="#conf-collation-libc-locale">12.4.30. collation_libc_locale</a></span></dt>
  343. <dt><span class="sect2"><a href="#conf-plugin-dir">12.4.31. plugin_dir</a></span></dt>
  344. <dt><span class="sect2"><a href="#conf-mysql-version-string">12.4.32. mysql_version_string</a></span></dt>
  345. <dt><span class="sect2"><a href="#conf-rt-flush-period">12.4.33. rt_flush_period</a></span></dt>
  346. <dt><span class="sect2"><a href="#conf-thread-stack">12.4.34. thread_stack</a></span></dt>
  347. <dt><span class="sect2"><a href="#conf-expansion-limit">12.4.35. expansion_limit</a></span></dt>
  348. <dt><span class="sect2"><a href="#conf-watchdog">12.4.36. watchdog</a></span></dt>
  349. <dt><span class="sect2"><a href="#conf-prefork-rotation-throttle">12.4.37. prefork_rotation_throttle</a></span></dt>
  350. <dt><span class="sect2"><a href="#conf-sphinxql-state">12.4.38. sphinxql_state</a></span></dt>
  351. <dt><span class="sect2"><a href="#conf-ha-ping-interval">12.4.39. ha_ping_interval</a></span></dt>
  352. <dt><span class="sect2"><a href="#conf-ha-period-karma">12.4.40. ha_period_karma</a></span></dt>
  353. <dt><span class="sect2"><a href="#conf-persistent-connections-limit">12.4.41. persistent_connections_limit</a></span></dt>
  354. <dt><span class="sect2"><a href="#conf-rt-merge-iops">12.4.42. rt_merge_iops</a></span></dt>
  355. <dt><span class="sect2"><a href="#conf-rt-merge-maxiosize">12.4.43. rt_merge_maxiosize</a></span></dt>
  356. <dt><span class="sect2"><a href="#conf-predicted-time-costs">12.4.44. predicted_time_costs</a></span></dt>
  357. <dt><span class="sect2"><a href="#conf-shutdown-timeout">12.4.45. shutdown_timeout</a></span></dt>
  358. <dt><span class="sect2"><a href="#conf-ondisk-attrs-default">12.4.46. ondisk_attrs_default</a></span></dt>
  359. <dt><span class="sect2"><a href="#conf-query-log-min-msec">12.4.47. query_log_min_msec</a></span></dt>
  360. <dt><span class="sect2"><a href="#conf-agent-connect-timeout-default">12.4.48. agent_connect_timeout</a></span></dt>
  361. <dt><span class="sect2"><a href="#conf-agent-query-timeout-default">12.4.49. agent_query_timeout</a></span></dt>
  362. <dt><span class="sect2"><a href="#conf-agent-retry-count">12.4.50. agent_retry_count</a></span></dt>
  363. <dt><span class="sect2"><a href="#conf-agent-retry-delay">12.4.51. agent_retry_delay</a></span></dt>
  364. </dl></dd><dt><span class="sect1"><a href="#confgroup-common">12.5. Common section configuration options</a></span></dt>
  365. <dd><dl><dt><span class="sect2"><a href="#conf-lemmatizer-base">12.5.1. lemmatizer_base</a></span></dt>
  366. <dt><span class="sect2"><a href="#conf-on-json-attr-error">12.5.2. on_json_attr_error</a></span></dt>
  367. <dt><span class="sect2"><a href="#conf-json-autoconv-numbers">12.5.3. json_autoconv_numbers</a></span></dt>
  368. <dt><span class="sect2"><a href="#conf-json-autoconv-keynames">12.5.4. json_autoconv_keynames</a></span></dt>
  369. <dt><span class="sect2"><a href="#conf-rlp-root">12.5.5. rlp_root</a></span></dt>
  370. <dt><span class="sect2"><a href="#conf-rlp-environment">12.5.6. rlp_environment</a></span></dt>
  371. <dt><span class="sect2"><a href="#conf-rlp-max-batch-size">12.5.7. rlp_max_batch_size</a></span></dt>
  372. <dt><span class="sect2"><a href="#conf-rlp-max-batch-docs">12.5.8. rlp_max_batch_docs</a></span></dt>
  373. </dl></dd></dl></dd><dt><span class="appendix"><a href="#changelog">A. Sphinx revision history</a></span></dt>
  374. <dd><dl><dt><span class="sect1"><a href="#rel226">A.1. Version 2.2.6-release, 13 nov 2014</a></span></dt>
  375. <dt><span class="sect1"><a href="#rel225">A.2. Version 2.2.5-release, 06 oct 2014</a></span></dt>
  376. <dt><span class="sect1"><a href="#rel224">A.3. Version 2.2.4-release, 11 sep 2014</a></span></dt>
  377. <dt><span class="sect1"><a href="#rel223">A.4. Version 2.2.3-beta, 13 may 2014</a></span></dt>
  378. <dt><span class="sect1"><a href="#rel222">A.5. Version 2.2.2-beta, 11 feb 2014</a></span></dt>
  379. <dt><span class="sect1"><a href="#rel221">A.6. Version 2.2.1-beta, 13 nov 2013</a></span></dt>
  380. <dt><span class="sect1"><a href="#rel219">A.7. Version 2.1.9-release, 03 jul 2014</a></span></dt>
  381. <dt><span class="sect1"><a href="#rel218">A.8. Version 2.1.8-release, 28 apr 2014</a></span></dt>
  382. <dt><span class="sect1"><a href="#rel217">A.9. Version 2.1.7-release, 30 mar 2014</a></span></dt>
  383. <dt><span class="sect1"><a href="#rel216">A.10. Version 2.1.6-release, 24 feb 2014</a></span></dt>
  384. <dt><span class="sect1"><a href="#rel215">A.11. Version 2.1.5-release, 22 jan 2014</a></span></dt>
  385. <dt><span class="sect1"><a href="#rel214">A.12. Version 2.1.4-release, 18 dec 2013</a></span></dt>
  386. <dt><span class="sect1"><a href="#rel213">A.13. Version 2.1.3-release, 12 nov 2013</a></span></dt>
  387. <dt><span class="sect1"><a href="#rel212">A.14. Version 2.1.2-release, 10 oct 2013</a></span></dt>
  388. <dt><span class="sect1"><a href="#rel211">A.15. Version 2.1.1-beta, 20 feb 2013</a></span></dt>
  389. <dt><span class="sect1"><a href="#rel2011">A.16. Version 2.0.11-dev, xx xxx xxxx</a></span></dt>
  390. <dt><span class="sect1"><a href="#rel2010">A.17. Version 2.0.10-release, 22 jan 2014</a></span></dt>
  391. <dt><span class="sect1"><a href="#rel209">A.18. Version 2.0.9-release, 26 aug 2013</a></span></dt>
  392. <dt><span class="sect1"><a href="#rel208">A.19. Version 2.0.8-release, 26 apr 2013</a></span></dt>
  393. <dt><span class="sect1"><a href="#rel207">A.20. Version 2.0.7-release, 26 mar 2013</a></span></dt>
  394. <dt><span class="sect1"><a href="#rel206">A.21. Version 2.0.6-release, 22 oct 2012</a></span></dt>
  395. <dt><span class="sect1"><a href="#rel205">A.22. Version 2.0.5-release, 28 jul 2012</a></span></dt>
  396. <dt><span class="sect1"><a href="#rel204">A.23. Version 2.0.4-release, 02 mar 2012</a></span></dt>
  397. <dt><span class="sect1"><a href="#rel203">A.24. Version 2.0.3-release, 23 dec 2011</a></span></dt>
  398. <dt><span class="sect1"><a href="#rel202">A.25. Version 2.0.2-beta, 15 nov 2011</a></span></dt>
  399. <dt><span class="sect1"><a href="#rel201">A.26. Version 2.0.1-beta, 22 apr 2011</a></span></dt>
  400. <dt><span class="sect1"><a href="#rel110">A.27. Version 1.10-beta, 19 jul 2010</a></span></dt>
  401. <dt><span class="sect1"><a href="#rel099">A.28. Version 0.9.9-release, 02 dec 2009</a></span></dt>
  402. <dt><span class="sect1"><a href="#rel099rc2">A.29. Version 0.9.9-rc2, 08 apr 2009</a></span></dt>
  403. <dt><span class="sect1"><a href="#rel099rc1">A.30. Version 0.9.9-rc1, 17 nov 2008</a></span></dt>
  404. <dt><span class="sect1"><a href="#rel0981">A.31. Version 0.9.8.1, 30 oct 2008</a></span></dt>
  405. <dt><span class="sect1"><a href="#rel098">A.32. Version 0.9.8, 14 jul 2008</a></span></dt>
  406. <dt><span class="sect1"><a href="#rel097">A.33. Version 0.9.7, 02 apr 2007</a></span></dt>
  407. <dt><span class="sect1"><a href="#rel097rc2">A.34. Version 0.9.7-rc2, 15 dec 2006</a></span></dt>
  408. <dt><span class="sect1"><a href="#rel097rc">A.35. Version 0.9.7-rc1, 26 oct 2006</a></span></dt>
  409. <dt><span class="sect1"><a href="#rel096">A.36. Version 0.9.6, 24 jul 2006</a></span></dt>
  410. <dt><span class="sect1"><a href="#rel096rc1">A.37. Version 0.9.6-rc1, 26 jun 2006</a></span></dt>
  411. </dl></dd></dl></div>
  412. <div class="list-of-tables"><p><b>List of Tables</b></p><dl><dt>5.1. <a href="#ranking-factors-table"></a></dt>
  413. </dl></div>
  414. <div class="list-of-examples"><p><b>List of Examples</b></p><dl><dt>3.1. <a href="#ex-ranged-queries">Ranged query usage example</a></dt>
  415. <dt>3.2. <a href="#ex-xmlpipe2-document">xmlpipe2 document stream</a></dt>
  416. <dt>3.3. <a href="#ex-live-updates">Fully automated live updates</a></dt>
  417. <dt>4.1. <a href="#ex-rt-updates">RT index declaration</a></dt>
  418. <dt>5.1. <a href="#ex-boolean-query">Boolean query example</a></dt>
  419. <dt>5.2. <a href="#ex-extended-query">Extended matching mode: query example</a></dt>
  420. </dl></div>
  421. <div class="chapter" title="Chapter&nbsp;1.&nbsp;Introduction"><div class="titlepage"><div><div><h2 class="title"><a name="intro"></a>Chapter&nbsp;1.&nbsp;Introduction</h2></div></div></div>
  422. <div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#about">1.1. About</a></span></dt>
  423. <dt><span class="sect1"><a href="#features">1.2. Sphinx features</a></span></dt>
  424. <dt><span class="sect1"><a href="#getting">1.3. Where to get Sphinx</a></span></dt>
  425. <dt><span class="sect1"><a href="#license">1.4. License</a></span></dt>
  426. <dt><span class="sect1"><a href="#credits">1.5. Credits</a></span></dt>
  427. <dt><span class="sect1"><a href="#history">1.6. History</a></span></dt>
  428. </dl></div>
  429. <div class="sect1" title="1.1.&nbsp;About"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="about"></a>1.1.&nbsp;About</h2></div></div></div>
  430. <p>
  431. Sphinx is a full-text search engine, publicly distributed under GPL version 2.
  432. Commercial licensing (eg. for embedded use) is available upon request.
  433. </p><p>
  434. Technically, Sphinx is a standalone software package provides
  435. fast and relevant full-text search functionality to client applications.
  436. It was specially designed to integrate well with SQL databases storing
  437. the data, and to be easily accessed by scripting languages. However, Sphinx
  438. does not depend on nor require any specific database to function.
  439. </p><p>
  440. Applications can access Sphinx search daemon (searchd) using any of
  441. the three different access methods: a) via Sphinx own implementation of MySQL
  442. network protocol (using a small SQL subset called SphinxQL, this is recommended
  443. way), b) via native search API (SphinxAPI) or c) via MySQL server with a
  444. pluggable storage engine (SphinxSE).
  445. </p><p>
  446. Official native SphinxAPI implementations for PHP, Perl, Python, Ruby and Java
  447. are included within the distribution package. API is very lightweight
  448. so porting it to a new language is known to take a few hours or days.
  449. Third party API ports and plugins exist for Perl, C#, Haskell,
  450. Ruby-on-Rails, and possibly other languages and frameworks.
  451. </p><p>
  452. Starting from version 1.10-beta, Sphinx supports two different indexing
  453. backends: "disk" index backend, and "realtime" (RT) index backend.
  454. Disk indexes support online full-text index rebuilds, but online updates
  455. can only be done on non-text (attribute) data. RT indexes additionally
  456. allow for online full-text index updates. Previous versions only
  457. supported disk indexes.
  458. </p><p>
  459. Data can be loaded into disk indexes using a so-called data source.
  460. Built-in sources can fetch data directly from MySQL, PostgreSQL, MSSQL, ODBC
  461. compliant database (Oracle, etc) or a pipe in TSV or a custom XML format.
  462. Adding new data sources drivers (eg. to natively support other DBMSes)
  463. is designed to be as easy as possible. RT indexes, as of 1.10-beta,
  464. can only be populated using SphinxQL.
  465. </p><p>
  466. As for the name, Sphinx is an acronym which is officially decoded
  467. as SQL Phrase Index. Yes, I know about CMU's Sphinx project.
  468. </p></div>
  469. <div class="sect1" title="1.2.&nbsp;Sphinx features"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="features"></a>1.2.&nbsp;Sphinx features</h2></div></div></div>
  470. <p>
  471. Key Sphinx features are:
  472. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>high indexing and searching performance;</p></li>
  473. <li class="listitem"><p>advanced indexing and querying tools (flexible and feature-rich text tokenizer, querying language, several different ranking modes, etc);</p></li>
  474. <li class="listitem"><p>advanced result set post-processing (SELECT with expressions, WHERE, ORDER BY, GROUP BY, HAVING etc over text search results);</p></li>
  475. <li class="listitem"><p>proven scalability up to billions of documents, terabytes of data, and thousands of queries per second;</p></li>
  476. <li class="listitem"><p>easy integration with SQL and XML data sources, and SphinxQL, SphinxAPI, or SphinxSE search interfaces;</p></li>
  477. <li class="listitem"><p>easy scaling with distributed searches.</p></li>
  478. </ul></div>
  479. <p>
  480. To expand a bit, Sphinx:
  481. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>has high indexing speed (upto 10-15 MB/sec per core on an internal benchmark);</p></li>
  482. <li class="listitem"><p>has high search speed (upto 150-250 queries/sec per core against 1,000,000 documents, 1.2 GB of data on an internal benchmark);</p></li>
  483. <li class="listitem"><p>has high scalability (biggest known cluster indexes over 3,000,000,000 documents, and busiest one peaks over 50,000,000 queries/day);</p></li>
  484. <li class="listitem"><p>provides good relevance ranking through combination of phrase proximity ranking and statistical (BM25) ranking;</p></li>
  485. <li class="listitem"><p>provides distributed searching capabilities;</p></li>
  486. <li class="listitem"><p>provides document excerpts (snippets) generation;</p></li>
  487. <li class="listitem"><p>provides searching from within application with SphinxQL or SphinxAPI interfaces, and from within MySQL with pluggable SphinxSE storage engine;</p></li>
  488. <li class="listitem"><p>supports boolean, phrase, word proximity and other types of queries;</p></li>
  489. <li class="listitem"><p>supports multiple full-text fields per document (upto 32 by default);</p></li>
  490. <li class="listitem"><p>supports multiple additional attributes per document (ie. groups, timestamps, etc);</p></li>
  491. <li class="listitem"><p>supports stopwords;</p></li>
  492. <li class="listitem"><p>supports morphological word forms dictionaries;</p></li>
  493. <li class="listitem"><p>supports tokenizing exceptions;</p></li>
  494. <li class="listitem"><p>supports UTF-8 encoding;</p></li>
  495. <li class="listitem"><p>supports stemming (stemmers for English, Russian, Czech and Arabic are built-in; and stemmers for
  496. French, Spanish, Portuguese, Italian, Romanian, German, Dutch, Swedish, Norwegian, Danish, Finnish, Hungarian,
  497. are available by building third party <a class="ulink" href="http://snowball.tartarus.org/" target="_top">libstemmer library</a>);</p></li>
  498. <li class="listitem"><p>supports MySQL natively (all types of tables, including MyISAM, InnoDB, NDB, Archive, etc are supported);</p></li>
  499. <li class="listitem"><p>supports PostgreSQL natively;</p></li>
  500. <li class="listitem"><p>supports ODBC compliant databases (MS SQL, Oracle, etc) natively;</p></li>
  501. <li class="listitem"><p>...has 50+ other features not listed here, refer configuration manual!</p></li>
  502. </ul></div>
  503. <p>
  504. </p></div>
  505. <div class="sect1" title="1.3.&nbsp;Where to get Sphinx"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="getting"></a>1.3.&nbsp;Where to get Sphinx</h2></div></div></div>
  506. <p>Sphinx is available through its official Web site at <a class="ulink" href="http://sphinxsearch.com/" target="_top">http://sphinxsearch.com/</a>.
  507. </p><p>Currently, Sphinx distribution tarball includes the following software:
  508. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="filename">indexer</code>: an utility which creates fulltext indexes;</p></li>
  509. <li class="listitem"><p><code class="filename">searchd</code>: a daemon which enables external software (eg. Web applications) to search through fulltext indexes;</p></li>
  510. <li class="listitem"><p><code class="filename">sphinxapi</code>: a set of searchd client API libraries for popular Web scripting languages (PHP, Python, Perl, Ruby).</p></li>
  511. <li class="listitem"><p><code class="filename">spelldump</code>: a simple command-line tool to extract the items from an <code class="filename">ispell</code> or <code class="filename">MySpell</code>
  512. (as bundled with OpenOffice) format dictionary to help customize your index, for use with <a class="link" href="#conf-wordforms" title="12.2.12.&nbsp;wordforms">wordforms</a>.</p></li>
  513. <li class="listitem"><p><code class="filename">indextool</code>: an utility to dump miscellaneous debug information about the index, added in version 0.9.9-rc2.</p></li>
  514. <li class="listitem"><p><code class="filename">wordbreaker</code>: an utility to break down compound words into separate words, added in version 2.1.1.</p></li>
  515. </ul></div>
  516. <p>
  517. </p></div>
  518. <div class="sect1" title="1.4.&nbsp;License"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="license"></a>1.4.&nbsp;License</h2></div></div></div>
  519. <p>
  520. This program is free software; you can redistribute it and/or modify
  521. it under the terms of the GNU General Public License as published by
  522. the Free Software Foundation; either version 2 of the License,
  523. or (at your option) any later version. See COPYING file for details.
  524. </p><p>
  525. This program is distributed in the hope that it will be useful,
  526. but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  527. or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  528. more details.
  529. </p><p>
  530. You should have received a copy of the GNU General Public License
  531. along with this program; if not, write to the Free Software Foundation, Inc.,
  532. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  533. </p><p>
  534. Non-GPL licensing (for OEM/ISV embedded use) can also be arranged, please
  535. <a class="ulink" href="http://sphinxsearch.com/contacts.html" target="_top">contact us</a> to discuss
  536. commercial licensing possibilities.
  537. </p></div>
  538. <div class="sect1" title="1.5.&nbsp;Credits"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="credits"></a>1.5.&nbsp;Credits</h2></div></div></div>
  539. <h3><a name="idp25805760"></a>Author</h3><p>
  540. Sphinx initial author (and a benevolent dictator ever since):
  541. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Andrew Aksyonoff, <a class="ulink" href="http://shodan.ru" target="_top">http://shodan.ru</a></p></li>
  542. </ul></div>
  543. <p>
  544. </p><h3><a name="idp31004880"></a>Team</h3><p>
  545. Past and present employees of Sphinx Technologies Inc who should be
  546. noted on their work on Sphinx (in alphabetical order):
  547. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Adam Rice</p></li>
  548. <li class="listitem"><p>Adrian Nuta</p></li>
  549. <li class="listitem"><p>Alexander Klimenko</p></li>
  550. <li class="listitem"><p>Alexey Dvoichenkov</p></li>
  551. <li class="listitem"><p>Alexey Vinogradov</p></li>
  552. <li class="listitem"><p>Anton Tsitlionok</p></li>
  553. <li class="listitem"><p>Eugene Kosov</p></li>
  554. <li class="listitem"><p>Gloria Vinogradova</p></li>
  555. <li class="listitem"><p>Ilya Kuznetsov</p></li>
  556. <li class="listitem"><p>Kirill Shmatov</p></li>
  557. <li class="listitem"><p>Rich Kelm</p></li>
  558. <li class="listitem"><p>Stanislav Klinov</p></li>
  559. <li class="listitem"><p>Steven Barker</p></li>
  560. <li class="listitem"><p>Vladimir Fedorkov</p></li>
  561. <li class="listitem"><p>Yuri Schapov</p></li>
  562. </ul></div>
  563. <p>
  564. </p><h3><a name="idp31013856"></a>Contributors</h3><p>People who contributed to Sphinx and their contributions (in no particular order):
  565. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Robert "coredev" Bengtsson (Sweden), initial version of PostgreSQL data source</p></li>
  566. <li class="listitem"><p>Len Kranendonk, Perl API</p></li>
  567. <li class="listitem"><p>Dmytro Shteflyuk, Ruby API</p></li>
  568. </ul></div>
  569. <p>
  570. </p><p>
  571. Many other people have contributed ideas, bug reports, fixes, etc.
  572. Thank you!
  573. </p></div>
  574. <div class="sect1" title="1.6.&nbsp;History"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="history"></a>1.6.&nbsp;History</h2></div></div></div>
  575. <p>
  576. Sphinx development was started back in 2001, because I didn't manage
  577. to find an acceptable search solution (for a database driven Web site)
  578. which would meet my requirements. Actually, each and every important aspect was a problem:
  579. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>search quality (ie. good relevance)
  580. </p><div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>statistical ranking methods performed rather bad, especially on large collections of small documents (forums, blogs, etc)</p></li>
  581. </ul></div>
  582. <p>
  583. </p></li>
  584. <li class="listitem"><p>search speed
  585. </p><div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>especially if searching for phrases which contain stopwords, as in "to be or not to be"</p></li>
  586. </ul></div>
  587. <p>
  588. </p></li>
  589. <li class="listitem"><p>moderate disk and CPU requirements when indexing
  590. </p><div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>important in shared hosting environment, not to mention the indexing speed.</p></li>
  591. </ul></div>
  592. <p>
  593. </p></li>
  594. </ul></div>
  595. <p>
  596. </p><p>
  597. Despite the amount of time passed and numerous improvements made in the
  598. other solutions, there's still no solution which I personally would
  599. be eager to migrate to.
  600. </p><p>
  601. Considering that and a lot of positive feedback received from Sphinx users
  602. during last years, the obvious decision is to continue developing Sphinx
  603. (and, eventually, to take over the world).
  604. </p></div></div>
  605. <div class="chapter" title="Chapter&nbsp;2.&nbsp;Installation"><div class="titlepage"><div><div><h2 class="title"><a name="installation"></a>Chapter&nbsp;2.&nbsp;Installation</h2></div></div></div>
  606. <div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#supported-system">2.1. Supported systems</a></span></dt>
  607. <dt><span class="sect1"><a href="#compiling-from-source">2.2. Compiling Sphinx from source</a></span></dt>
  608. <dd><dl><dt><span class="sect2"><a href="#required-tools">2.2.1. Required tools</a></span></dt>
  609. <dt><span class="sect2"><a href="#compiling-source-linux">2.2.2. Compiling on Linux</a></span></dt>
  610. <dt><span class="sect2"><a href="#compiling-source-problems">2.2.3. Known compilation issues</a></span></dt>
  611. </dl></dd><dt><span class="sect1"><a href="#installing-debian">2.3. Installing Sphinx packages on Debian and Ubuntu</a></span></dt>
  612. <dt><span class="sect1"><a href="#installing-redhat">2.4. Installing Sphinx packages on RedHat and CentOS</a></span></dt>
  613. <dt><span class="sect1"><a href="#installing-windows">2.5. Installing Sphinx on Windows</a></span></dt>
  614. <dt><span class="sect1"><a href="#sphinx-deprecations-defaults">2.6. Sphinx deprecations and changes in default configuration</a></span></dt>
  615. <dt><span class="sect1"><a href="#quick-tour">2.7. Quick Sphinx usage tour</a></span></dt>
  616. </dl></div>
  617. <div class="sect1" title="2.1.&nbsp;Supported systems"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="supported-system"></a>2.1.&nbsp;Supported systems</h2></div></div></div>
  618. <p>
  619. Sphinx can be compiled either from source or installed using prebuilt
  620. packages. Most modern UNIX systems with a C++ compiler should be able
  621. to compile and run Sphinx without any modifications.
  622. </p><p>
  623. Currently known systems Sphinx has been successfully running on are:
  624. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Linux 2.4.x, 2.6.x, 3.x (many various distributions)</p></li>
  625. <li class="listitem"><p>Windows 2000, XP, 7, 8</p></li>
  626. <li class="listitem"><p>FreeBSD 4.x, 5.x, 6.x, 7.x, 8.x</p></li>
  627. <li class="listitem"><p>NetBSD 1.6, 3.0</p></li>
  628. <li class="listitem"><p>Solaris 9, 11</p></li>
  629. <li class="listitem"><p>Mac OS X</p></li>
  630. </ul></div>
  631. <p>
  632. </p><p>
  633. CPU architectures known to work include i386 (aka x86), amd64 (aka x86_64),
  634. SPARC64, and ARM.
  635. </p><p>
  636. Chances are good that Sphinx should work on other Unix platforms and/or
  637. CPU architectures just as well. Please report any other platforms that
  638. worked for you!
  639. </p><p>
  640. All platforms are production quality. There are no principal functional
  641. limitations on any platform.
  642. </p></div>
  643. <div class="sect1" title="2.2.&nbsp;Compiling Sphinx from source"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="compiling-from-source"></a>2.2.&nbsp;Compiling Sphinx from source</h2></div></div></div>
  644. <div class="sect2" title="2.2.1.&nbsp;Required tools"><div class="titlepage"><div><div><h3 class="title"><a name="required-tools"></a>2.2.1.&nbsp;Required tools</h3></div></div></div>
  645. <p>
  646. On UNIX, you will need the following tools to build
  647. and install Sphinx:
  648. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>a working C++ compiler. GNU gcc and clang are known to work.</p></li>
  649. <li class="listitem"><p>a good make program. GNU make is known to work.</p></li>
  650. </ul></div>
  651. <p>
  652. </p><p>
  653. On Windows, you will need Microsoft Visual C/C++ Studio .NET 2005 or above.
  654. Other compilers/environments will probably work as well, but for the
  655. time being, you will have to build makefile (or other environment
  656. specific project files) manually.
  657. </p></div>
  658. <div class="sect2" title="2.2.2.&nbsp;Compiling on Linux"><div class="titlepage"><div><div><h3 class="title"><a name="compiling-source-linux"></a>2.2.2.&nbsp;Compiling on Linux</h3></div></div></div>
  659. <div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
  660. Extract everything from the distribution tarball (haven't you already?)
  661. and go to the <code class="filename">sphinx</code> subdirectory. (We are using
  662. version 2.2.1-beta here for the sake of example only; be sure to change this
  663. to a specific version you're using.)
  664. </p><div class="literallayout"><p><strong class="userinput"><code>$&nbsp;tar&nbsp;xzvf&nbsp;sphinx-2.2.1-beta.tar.gz<br>
  665. $&nbsp;cd&nbsp;sphinx<br>
  666. </code></strong></p></div></li>
  667. <li class="listitem"><p>Run the configuration program:</p><div class="literallayout"><p><strong class="userinput"><code>$&nbsp;./configure</code></strong></p></div>
  668. <p>
  669. There's a number of options to configure. The complete listing may
  670. be obtained by using <code class="option">--help</code> switch. The most important ones are:
  671. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="option">--prefix</code>, which specifies where to install Sphinx; such as <code class="option">--prefix=/usr/local/sphinx</code> (all of the examples use this prefix)</p></li>
  672. <li class="listitem"><p><code class="option">--with-mysql</code>, which specifies where to look for MySQL include and library files, if auto-detection fails;</p></li>
  673. <li class="listitem"><p><code class="option">--with-static-mysql</code>, which builds Sphinx with statically linked MySQL support;</p></li>
  674. <li class="listitem"><p><code class="option">--with-pgsql</code>, which specifies where to look for PostgreSQL include and library files.</p></li>
  675. <li class="listitem"><p><code class="option">--with-static-pgsql</code>, which builds Sphinx with statically linked PostgreSQL support;</p></li>
  676. </ul></div>
  677. <p>
  678. </p></li>
  679. <li class="listitem"><p>Build the binaries:</p><div class="literallayout"><p><strong class="userinput"><code>$&nbsp;make</code></strong></p></div></li>
  680. <li class="listitem"><p>Install the binaries in the directory of your choice:
  681. (defaults to <code class="filename">/usr/local/bin/</code> on *nix systems,
  682. but is overridden with <code class="option">configure --prefix</code>)</p><div class="literallayout"><p><strong class="userinput"><code>$&nbsp;make&nbsp;install</code></strong></p></div></li>
  683. </ol></div></div>
  684. <div class="sect2" title="2.2.3.&nbsp;Known compilation issues"><div class="titlepage"><div><div><h3 class="title"><a name="compiling-source-problems"></a>2.2.3.&nbsp;Known compilation issues</h3></div></div></div>
  685. <p>
  686. If <code class="filename">configure</code> fails to locate MySQL headers and/or libraries,
  687. try checking for and installing <code class="filename">mysql-devel</code> package. On some systems,
  688. it is not installed by default.
  689. </p><p>
  690. If <code class="filename">make</code> fails with a message which look like
  691. </p><pre class="programlisting">
  692. /bin/sh: g++: command not found
  693. make[1]: *** [libsphinx_a-sphinx.o] Error 127
  694. </pre><p>
  695. try checking for and installing <code class="filename">gcc-c++</code> package.
  696. </p><p>
  697. If you are getting compile-time errors which look like
  698. </p><pre class="programlisting">
  699. sphinx.cpp:67: error: invalid application of `sizeof' to
  700. incomplete type `Private::SizeError&lt;false&gt;'
  701. </pre><p>
  702. this means that some compile-time type size check failed.
  703. The most probable reason is that off_t type is less than 64-bit
  704. on your system. As a quick hack, you can edit sphinx.h and replace off_t
  705. with DWORD in a typedef for SphOffset_t, but note that this will prohibit
  706. you from using full-text indexes larger than 2 GB. Even if the hack helps,
  707. please report such issues, providing the exact error message and
  708. compiler/OS details, so I could properly fix them in next releases.
  709. </p><p>
  710. If you keep getting any other error, or the suggestions above
  711. do not seem to help you, please don't hesitate to contact me.
  712. </p></div></div>
  713. <div class="sect1" title="2.3.&nbsp;Installing Sphinx packages on Debian and Ubuntu"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="installing-debian"></a>2.3.&nbsp;Installing Sphinx packages on Debian and Ubuntu</h2></div></div></div>
  714. <p>There are two ways of getting Sphinx for Ubuntu: regular deb packages and the Launchpad PPA repository.</p><p>Deb packages:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>Sphinx requires a few libraries to be installed on Debian/Ubuntu. Use apt-get to download and install these dependencies:</p><strong class="userinput"><code>$ sudo apt-get install mysql-client unixodbc libpq5</code></strong></li>
  715. <li class="listitem"><p>Now you can install Sphinx:</p><strong class="userinput"><code>$ sudo dpkg -i sphinxsearch_2.2.1-beta-0ubuntu11~precise_amd64.deb</code></strong></li>
  716. </ol></div>
  717. <p>PPA repository (Ubuntu only).</p><p>Installing Sphinx is much easier from Sphinxsearch PPA repository, because you will get all dependencies and can also update Sphinx to the latest version with the same command.</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>First, add Sphinxsearch repository and update the list of packages:</p><p><strong class="userinput"><code>$ sudo add-apt-repository ppa:builds/sphinxsearch-daily</code></strong></p><p><strong class="userinput"><code>$ sudo apt-get update</code></strong></p></li>
  718. <li class="listitem"><p>Install/update sphinxsearch package:</p><p><strong class="userinput"><code>$ sudo apt-get install sphinxsearch</code></strong></p></li>
  719. </ol></div>
  720. <p>Sphinx <code class="filename">searchd</code> daemon can be started/stopped using service command:</p><p><strong class="userinput"><code>$ sudo service sphinxsearch start</code></strong></p></div>
  721. <div class="sect1" title="2.4.&nbsp;Installing Sphinx packages on RedHat and CentOS"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="installing-redhat"></a>2.4.&nbsp;Installing Sphinx packages on RedHat and CentOS</h2></div></div></div>
  722. <p>Currently we distribute Sphinx RPMS and SRPMS on our website for both 5.x and 6.x
  723. versions of Red Hat Enterprise Linux, but they can be installed on CentOS as well.</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>Before installation make sure you have these packages installed:</p><p><strong class="userinput"><code>$ yum install postgresql-libs unixODBC</code></strong></p></li>
  724. <li class="listitem"><p>Download RedHat RPM from Sphinx website and install it:</p><p><strong class="userinput"><code>$ rpm -Uhv sphinx-2.2.1-1.rhel6.x86_64.rpm</code></strong></p></li>
  725. <li class="listitem"><p>After preparing configuration file (see <a class="link" href="#quick-tour" title="2.7.&nbsp;Quick Sphinx usage tour">Quick tour</a>), you can start searchd daemon:</p><p><strong class="userinput"><code>$ service searchd start</code></strong></p></li>
  726. </ol></div></div>
  727. <div class="sect1" title="2.5.&nbsp;Installing Sphinx on Windows"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="installing-windows"></a>2.5.&nbsp;Installing Sphinx on Windows</h2></div></div></div>
  728. <p>Installing Sphinx on a Windows server is often easier than installing on a Linux environment;
  729. unless you are preparing code patches, you can use the pre-compiled binary files from the Downloads
  730. area on the website.</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>Extract everything from the .zip file you have downloaded -
  731. <code class="filename">sphinx-2.2.1-beta-win32.zip</code>,
  732. or <code class="filename">sphinx-2.2.1-beta-win32-pgsql.zip</code> if you need PostgresSQL support as well.
  733. (We are using version 2.2.1-beta here for the sake of example only;
  734. be sure to change this to a specific version you're using.)
  735. You can use Windows Explorer in Windows XP and up to extract the files,
  736. or a freeware package like 7Zip to open the archive.</p><p>For the remainder of this guide, we will assume that the folders are unzipped into <code class="filename">C:\Sphinx</code>,
  737. such that <code class="filename">searchd.exe</code> can be found in <code class="filename">C:\Sphinx\bin\searchd.exe</code>. If you decide
  738. to use any different location for the folders or configuration file, please change it accordingly.</p></li>
  739. <li class="listitem"><p>Edit the contents of sphinx.conf.in - specifically entries relating to @CONFDIR@ - to paths suitable for your system.</p></li>
  740. <li class="listitem"><p>Install the <code class="filename">searchd</code> system as a Windows service:</p><p><strong class="userinput"><code>C:\Sphinx\bin&gt; C:\Sphinx\bin\searchd --install --config C:\Sphinx\sphinx.conf.in --servicename SphinxSearch</code></strong></p></li>
  741. <li class="listitem"><p>The <code class="filename">searchd</code> service will now be listed in the Services panel
  742. within the Management Console, available from Administrative Tools. It will not have been
  743. started, as you will need to configure it and build your indexes with <code class="filename">indexer</code>
  744. before starting the service. A guide to do this can be found under
  745. <a class="link" href="#quick-tour" title="2.7.&nbsp;Quick Sphinx usage tour">Quick tour</a>.</p><p>During the next steps of the install (which involve running indexer pretty much as
  746. you would on Linux) you may find that you get an error relating to libmysql.dll not being found.
  747. If you have MySQL installed, you should find a copy of this library in your Windows directory,
  748. or sometimes in Windows\System32, or failing that in the MySQL core directories. If you
  749. do receive an error please copy libmysql.dll into the bin directory.</p></li>
  750. </ol></div></div>
  751. <div class="sect1" title="2.6.&nbsp;Sphinx deprecations and changes in default configuration"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinx-deprecations-defaults"></a>2.6.&nbsp;Sphinx deprecations and changes in default configuration</h2></div></div></div>
  752. <p>
  753. In 2.2.1-beta version we decided to start removing some old features. All
  754. of them was 'unofficially' deprecated for some time. And we're informing
  755. you now about it.
  756. </p><p>
  757. Changes are as follows:
  758. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>32-bit document IDs are now deprecated. Our binary releases
  759. are now all built with 64-bit IDs by default. Note that they can still
  760. load older indexes with 32-bit IDs, but that support will eventually be
  761. removed. In fact, that was deprecated awhile ago, but now we just want to
  762. make it clear: we don't see any sense in trying to save your server's RAM
  763. this way.</p></li>
  764. <li class="listitem"><p>dict=crc is now deprecated. It has a bunch of limitations,
  765. the most important ones being keyword collisions, and no (good) wildcard
  766. matching support. You can read more about those limitations in our
  767. documentation.</p></li>
  768. <li class="listitem"><p>charset_type=sbcs is now deprecated, we're slowly switching
  769. to UTF-only. Even if your database is SBCS (likely for legacy reasons
  770. too, eh?), this should be absolutely trivial to workaround, just add a
  771. pre-query to fetch your data in UTF-8 and you're all set. Also, in fact,
  772. our current UTF-8 tokenizer is even faster than the SBCS one.</p></li>
  773. <li class="listitem"><p>custom sort (@custom) is now removed from Sphinx. This
  774. feature was introduced long before sort by expression became a reality
  775. and it has been deprecated for a very long time.</p></li>
  776. <li class="listitem"><p>enable_star is deprecated now. Previous default mode was
  777. enable_star=0 which was due to compatibility with a very old Sphinx
  778. version. Such implicit star search isn't very intuitive. So, we've decided
  779. to eventually remove it and have marked it as deprecated just recently. We plan
  780. to totally remove this configuration key in the 2.2.X branch.</p></li>
  781. <li class="listitem"><p>str2ordinal attributes are deprecated. This feature allows
  782. you to perform sorting by a string. But it's also possible to do this with
  783. ordinary string attributes, which is much easier to use. str2ordinal only
  784. covers a small part of this functionality and is not needed now.</p></li>
  785. <li class="listitem"><p>str2wordcount attributes are deprecated.
  786. <a class="link" href="#conf-index-field-lengths" title="12.2.63.&nbsp;index_field_lengths">index_field_lengths=1</a>
  787. will create an integer attribute with field length set automatically and we
  788. recommend to use this configuration key when you need to store field
  789. lengths. Also, index_field_lengths=1 allows you to use new ranking formulas
  790. like BM25F().</p></li>
  791. <li class="listitem"><p>hit_format is deprecated. This is a hidden configuration
  792. key - it's not mentioned in our documentation. But, it's there and it's
  793. possible that someone may use it. And now we're urging you: don't use it.
  794. The default value is 'inline' and it's a new standard. 'plain' hit_format
  795. is obsolete and will be removed in the near future.</p></li>
  796. <li class="listitem"><p>docinfo=inline is deprecated. You can now use
  797. <a class="link" href="#conf-ondisk-attrs" title="12.2.68.&nbsp;ondisk_attrs">ondisk_attrs</a> or
  798. <a class="link" href="#conf-ondisk-attrs-default" title="12.4.46.&nbsp;ondisk_attrs_default">ondisk_attrs_default</a> instead.</p></li>
  799. <li class="listitem"><p>workers=threads is a new default for all OS now.
  800. We're gonna get rid of other modes in future.</p></li>
  801. <li class="listitem"><p>mem_limit=128M is a new default.</p></li>
  802. <li class="listitem"><p>rt_mem_limit=128M is a new default.</p></li>
  803. <li class="listitem"><p>ondisk_dict is deprecated. No need to save RAM this way.</p></li>
  804. <li class="listitem"><p>ondisk_dict_default is deprecated. No need to save RAM this way.
  805. </p></li>
  806. <li class="listitem"><p>compat_sphinxql_magics was removed. Now you can't use an old
  807. result format and SphinxQL always looks more like ANSI SQL.</p></li>
  808. <li class="listitem"><p>Completely removed xmlpipe. This was a very old ad hoc solution
  809. for a particular customer. xmlpipe2 surpasses it in every single aspect.</p></li>
  810. </ul></div>
  811. <p>
  812. </p><p>None of the different querying methods are deprecated, but as of
  813. version 2.2.1-beta, SphinxQL is the most advanced method. We plan to
  814. remove SphinxAPI and Sphinx SE someday so it would be a good idea to
  815. start using SphinxQL.</p><p>
  816. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>The SetWeights() API call has been deprecated for a long
  817. time and has now been removed from official APIs.</p></li>
  818. <li class="listitem"><p>The default matching mode for the API is now 'extended'.
  819. Actually, all other modes are deprecated. We recommend using the
  820. <a class="link" href="#extended-syntax" title="5.3.&nbsp;Extended query syntax">extended query syntax</a> instead.
  821. </p></li>
  822. </ul></div>
  823. <p>
  824. </p><p>
  825. Changes for 2.2.2-beta:
  826. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Removed deprecated "address" and "port" directives.
  827. Use "listen" instead.</p></li>
  828. <li class="listitem"><p>Removed str2wordcount attributes.
  829. Use <a class="link" href="#conf-index-field-lengths" title="12.2.63.&nbsp;index_field_lengths">index_field_lengths=1</a>
  830. instead.</p></li>
  831. <li class="listitem"><p>Removed str2ordinal attributes. Use string attributes
  832. for sorting.</p></li>
  833. <li class="listitem"><p>ondisk_dict and ondisk_dict_default was removed.
  834. </p></li>
  835. <li class="listitem"><p>Removed charset_type and mssql_unicode - we now support
  836. only UTF-8 encoding.</p></li>
  837. <li class="listitem"><p>Removed deprecated enable_star. Now always work as
  838. with enable_star=1.</p></li>
  839. <li class="listitem"><p>Removed CLI search which confused people instead of
  840. helping them and sql_query_info.</p></li>
  841. <li class="listitem"><p>Deprecated SetMatchMode() API call.</p></li>
  842. <li class="listitem"><p>Changed default <a class="link" href="#conf-thread-stack" title="12.4.34.&nbsp;thread_stack">thread_stack
  843. </a> value to 1M.</p></li>
  844. <li class="listitem"><p>Deprecated SetOverride() API call.</p></li>
  845. </ul></div>
  846. <p>
  847. </p><p>
  848. Changes for 2.2.3-beta:
  849. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Removed unneeded max_matches key from config file.</p></li>
  850. </ul></div>
  851. <p>
  852. </p></div>
  853. <div class="sect1" title="2.7.&nbsp;Quick Sphinx usage tour"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="quick-tour"></a>2.7.&nbsp;Quick Sphinx usage tour</h2></div></div></div>
  854. <p>
  855. All the example commands below assume that you installed Sphinx
  856. in <code class="filename">/usr/local/sphinx</code>, so <code class="filename">searchd</code> can
  857. be found in <code class="filename">/usr/local/sphinx/bin/searchd</code>.
  858. </p><p>
  859. To use Sphinx, you will need to:
  860. </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>Create a configuration file.</p><p>
  861. Default configuration file name is <code class="filename">sphinx.conf</code>.
  862. All Sphinx programs look for this file in current working directory
  863. by default.
  864. </p><p>
  865. Sample configuration file, <code class="filename">sphinx.conf.dist</code>, which has
  866. all the options documented, is created by <code class="filename">configure</code>.
  867. Copy and edit that sample file to make your own configuration: (assuming Sphinx is installed into <code class="filename">/usr/local/sphinx/</code>)
  868. </p><div class="literallayout"><p><strong class="userinput"><code>$&nbsp;cd&nbsp;/usr/local/sphinx/etc<br>
  869. $&nbsp;cp&nbsp;sphinx.conf.dist&nbsp;sphinx.conf<br>
  870. $&nbsp;vi&nbsp;sphinx.conf</code></strong></p></div>
  871. <p>
  872. Sample configuration file is setup to index <code class="filename">documents</code>
  873. table from MySQL database <code class="filename">test</code>; so there's <code class="filename">example.sql</code>
  874. sample data file to populate that table with a few documents for testing purposes:
  875. </p><div class="literallayout"><p><strong class="userinput"><code>$&nbsp;mysql&nbsp;-u&nbsp;test&nbsp;&lt;&nbsp;/usr/local/sphinx/etc/example.sql</code></strong></p></div></li>
  876. <li class="listitem"><p>Run the indexer to create full-text index from your data:</p><div class="literallayout"><p><strong class="userinput"><code>$&nbsp;cd&nbsp;/usr/local/sphinx/etc<br>
  877. $&nbsp;/usr/local/sphinx/bin/indexer&nbsp;--all</code></strong></p></div></li>
  878. <li class="listitem"><p>Query your newly created index!</p></li>
  879. </ol></div>
  880. <p>Now query your indexes!</p><p>Connect to server:</p><div class="literallayout"><p><strong class="userinput"><code>$&nbsp;mysql&nbsp;-h0&nbsp;-P9306</code></strong></p></div>
  881. <div class="literallayout"><p><strong class="userinput"><code>SELECT&nbsp;*&nbsp;FROM&nbsp;test1&nbsp;WHERE&nbsp;MATCH('my&nbsp;document');</code></strong></p></div>
  882. <div class="literallayout"><p><strong class="userinput"><code>INSERT&nbsp;INTO&nbsp;rt&nbsp;VALUES&nbsp;(1,&nbsp;'this&nbsp;is',&nbsp;'a&nbsp;sample&nbsp;text',&nbsp;11);</code></strong></p></div>
  883. <div class="literallayout"><p><strong class="userinput"><code>INSERT&nbsp;INTO&nbsp;rt&nbsp;VALUES&nbsp;(2,&nbsp;'some&nbsp;more',&nbsp;'text&nbsp;here',&nbsp;22);</code></strong></p></div>
  884. <div class="literallayout"><p><strong class="userinput"><code>SELECT&nbsp;gid/11&nbsp;FROM&nbsp;rt&nbsp;WHERE&nbsp;MATCH('text')&nbsp;GROUP&nbsp;BY&nbsp;gid;</code></strong></p></div>
  885. <div class="literallayout"><p><strong class="userinput"><code>SELECT&nbsp;*&nbsp;FROM&nbsp;rt&nbsp;ORDER&nbsp;BY&nbsp;gid&nbsp;DESC;</code></strong></p></div>
  886. <div class="literallayout"><p><strong class="userinput"><code>SHOW&nbsp;TABLES;</code></strong></p></div>
  887. <div class="literallayout"><p><strong class="userinput"><code>SELECT&nbsp;*,&nbsp;WEIGHT()&nbsp;FROM&nbsp;test1&nbsp;WHERE&nbsp;MATCH('"document&nbsp;one"/1');SHOW&nbsp;META;</code></strong></p></div>
  888. <div class="literallayout"><p><strong class="userinput"><code>SET&nbsp;profiling=1;SELECT&nbsp;*&nbsp;FROM&nbsp;test1&nbsp;WHERE&nbsp;id&nbsp;IN&nbsp;(1,2,4);SHOW&nbsp;PROFILE;</code></strong></p></div>
  889. <div class="literallayout"><p><strong class="userinput"><code>SELECT&nbsp;id,&nbsp;id%3&nbsp;idd&nbsp;FROM&nbsp;test1&nbsp;WHERE&nbsp;MATCH('this&nbsp;is&nbsp;|&nbsp;nothing')&nbsp;GROUP&nbsp;BY&nbsp;idd;SHOW&nbsp;PROFILE;</code></strong></p></div>
  890. <div class="literallayout"><p><strong class="userinput"><code>SELECT&nbsp;id&nbsp;FROM&nbsp;test1&nbsp;WHERE&nbsp;MATCH('is&nbsp;this&nbsp;a&nbsp;good&nbsp;plan?');SHOW&nbsp;PLAN;</code></strong></p></div>
  891. <div class="literallayout"><p><strong class="userinput"><code>SELECT&nbsp;COUNT(*)&nbsp;c,&nbsp;id%3&nbsp;idd&nbsp;FROM&nbsp;test1&nbsp;GROUP&nbsp;BY&nbsp;idd&nbsp;HAVING&nbsp;COUNT(*)&gt;1;</code></strong></p></div>
  892. <div class="literallayout"><p><strong class="userinput"><code>SELECT&nbsp;COUNT(*)&nbsp;FROM&nbsp;test1;</code></strong></p></div>
  893. <div class="literallayout"><p><strong class="userinput"><code>CALL&nbsp;KEYWORDS&nbsp;('one&nbsp;two&nbsp;three',&nbsp;'test1');</code></strong></p></div>
  894. <div class="literallayout"><p><strong class="userinput"><code>CALL&nbsp;KEYWORDS&nbsp;('one&nbsp;two&nbsp;three',&nbsp;'test1',&nbsp;1);</code></strong></p></div>
  895. <p>
  896. Happy searching!
  897. </p></div></div>
  898. <div class="chapter" title="Chapter&nbsp;3.&nbsp;Indexing"><div class="titlepage"><div><div><h2 class="title"><a name="indexing"></a>Chapter&nbsp;3.&nbsp;Indexing</h2></div></div></div>
  899. <div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#sources">3.1. Data sources</a></span></dt>
  900. <dt><span class="sect1"><a href="#fields">3.2. Full-text fields</a></span></dt>
  901. <dt><span class="sect1"><a href="#attributes">3.3. Attributes</a></span></dt>
  902. <dt><span class="sect1"><a href="#mva">3.4. MVA (multi-valued attributes)</a></span></dt>
  903. <dt><span class="sect1"><a href="#indexes">3.5. Indexes</a></span></dt>
  904. <dt><span class="sect1"><a href="#data-restrictions">3.6. Restrictions on the source data</a></span></dt>
  905. <dt><span class="sect1"><a href="#charsets">3.7. Charsets, case folding, translation tables, and replacement rules</a></span></dt>
  906. <dt><span class="sect1"><a href="#sql">3.8. SQL data sources (MySQL, PostgreSQL)</a></span></dt>
  907. <dt><span class="sect1"><a href="#xmlpipe2">3.9. xmlpipe2 data source</a></span></dt>
  908. <dt><span class="sect1"><a href="#tsvpipe">3.10. tsvpipe (Tab Separated Values) data source</a></span></dt>
  909. <dt><span class="sect1"><a href="#live-updates">3.11. Live index updates</a></span></dt>
  910. <dt><span class="sect1"><a href="#delta-updates">3.12. Delta index updates</a></span></dt>
  911. <dt><span class="sect1"><a href="#index-merging">3.13. Index merging</a></span></dt>
  912. </dl></div>
  913. <div class="sect1" title="3.1.&nbsp;Data sources"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sources"></a>3.1.&nbsp;Data sources</h2></div></div></div>
  914. <p>
  915. The data to be indexed can generally come from very different
  916. sources: SQL databases, plain text files, HTML files, mailboxes,
  917. and so on. From Sphinx point of view, the data it indexes is a
  918. set of structured <em class="glossterm">documents</em>, each of which has the
  919. same set of <em class="glossterm">fields</em> and <em class="glossterm">attributes</em>.
  920. This is similar to SQL, where each row would correspond to a document,
  921. and each column to either a field or an attribute.
  922. </p><p>
  923. Depending on what source Sphinx should get the data from,
  924. different code is required to fetch the data and prepare it for indexing.
  925. This code is called <em class="glossterm">data source driver</em> (or simply
  926. <em class="glossterm">driver</em> or <em class="glossterm">data source</em> for brevity).
  927. </p><p>
  928. At the time of this writing, there are built-in drivers for
  929. MySQL, PostgreSQL, MS SQL (on Windows), and ODBC. There is also
  930. a generic driver called xmlpipe2, which runs a specified command
  931. and reads the data from its <code class="filename">stdout</code>.
  932. See <a class="xref" href="#xmlpipe2" title="3.9.&nbsp;xmlpipe2 data source">Section&nbsp;3.9, &#8220;xmlpipe2 data source&#8221;</a> section for the format description.
  933. In 2.2.1-beta a tsvpipe (Tab Separated Values) data source was added.
  934. You can get more information here <a class="xref" href="#tsvpipe" title="3.10.&nbsp;tsvpipe (Tab Separated Values) data source">Section&nbsp;3.10, &#8220;tsvpipe (Tab Separated Values) data source&#8221;</a>.
  935. </p><p>
  936. There can be as many sources per index as necessary. They will be
  937. sequentially processed in the very same order which was specified in
  938. index definition. All the documents coming from those sources
  939. will be merged as if they were coming from a single source.
  940. </p></div>
  941. <div class="sect1" title="3.2.&nbsp;Full-text fields"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="fields"></a>3.2.&nbsp;Full-text fields</h2></div></div></div>
  942. <p>
  943. Full-text fields (or just <em class="glossterm">fields</em> for brevity)
  944. are the textual document contents that get indexed by Sphinx, and can be
  945. (quickly) searched for keywords.
  946. </p><p>
  947. Fields are named, and you can limit your searches to a single
  948. field (eg. search through "title" only) or a subset of fields
  949. (eg. to "title" and "abstract" only). Sphinx index format generally
  950. supports up to 256 fields. However, up to version 2.0.1-beta indexes
  951. were forcibly limited by 32 fields, because of certain complications
  952. in the matching engine. Full support for up to 256 fields was added
  953. in version 2.0.2-beta.
  954. </p><p>
  955. Note that the original contents of the fields are <span class="bold"><strong>not</strong></span> stored
  956. in the Sphinx index. The text that you send to Sphinx gets processed,
  957. and a full-text index (a special data structure that enables quick
  958. searches for a keyword) gets built from that text. But the original
  959. text contents are then simply discarded. Sphinx assumes that you store
  960. those contents elsewhere anyway.
  961. </p><p>
  962. Moreover, it is impossible to <span class="emphasis"><em>fully</em></span> reconstruct
  963. the original text, because the specific whitespace, capitalization,
  964. punctuation, etc will all be lost during indexing. It is theoretically
  965. possible to partially reconstruct a given document from the Sphinx
  966. full-text index, but that would be a slow process (especially if
  967. the <a class="link" href="#conf-dict" title="12.2.7.&nbsp;dict">CRC dictionary</a> is used,
  968. which does not even store the original keywords and works with
  969. their hashes instead).
  970. </p></div>
  971. <div class="sect1" title="3.3.&nbsp;Attributes"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="attributes"></a>3.3.&nbsp;Attributes</h2></div></div></div>
  972. <p>
  973. Attributes are additional values associated with each document
  974. that can be used to perform additional filtering and sorting during search.
  975. </p><p>
  976. It is often desired to additionally process full-text search results
  977. based not only on matching document ID and its rank, but on a number
  978. of other per-document values as well. For instance, one might need to
  979. sort news search results by date and then relevance,
  980. or search through products within specified price range,
  981. or limit blog search to posts made by selected users,
  982. or group results by month. To do that efficiently, Sphinx allows
  983. to attach a number of additional <em class="glossterm">attributes</em>
  984. to each document, and store their values in the full-text index.
  985. It's then possible to use stored values to filter, sort,
  986. or group full-text matches.
  987. </p><p>Attributes, unlike the fields, are not full-text indexed. They
  988. are stored in the index, but it is not possible to search them as full-text,
  989. and attempting to do so results in an error.</p><p>For example, it is impossible to use the extended matching mode expression
  990. <code class="option">@column 1</code> to match documents where column is 1, if column is an
  991. attribute, and this is still true even if the numeric digits are normally indexed.</p><p>Attributes can be used for filtering, though, to restrict returned
  992. rows, as well as sorting or <a class="link" href="#clustering" title="5.7.&nbsp;Grouping (clustering) search results">result grouping</a>;
  993. it is entirely possible to sort results purely based on attributes, and ignore the search
  994. relevance tools. Additionally, attributes are returned from the search daemon, while the
  995. indexed text is not.</p><p>
  996. A good example for attributes would be a forum posts table. Assume
  997. that only title and content fields need to be full-text searchable -
  998. but that sometimes it is also required to limit search to a certain
  999. author or a sub-forum (ie. search only those rows that have some
  1000. specific values of author_id or forum_id columns in the SQL table);
  1001. or to sort matches by post_date column; or to group matching posts
  1002. by month of the post_date and calculate per-group match counts.
  1003. </p><p>
  1004. This can be achieved by specifying all the mentioned columns
  1005. (excluding title and content, that are full-text fields) as
  1006. attributes, indexing them, and then using API calls to
  1007. setup filtering, sorting, and grouping. Here as an example.
  1008. </p><h3><a name="idp31184032"></a>Example sphinx.conf part:</h3><pre class="programlisting">
  1009. ...
  1010. sql_query = SELECT id, title, content, \
  1011. author_id, forum_id, post_date FROM my_forum_posts
  1012. sql_attr_uint = author_id
  1013. sql_attr_uint = forum_id
  1014. sql_attr_timestamp = post_date
  1015. ...
  1016. </pre><h3><a name="idp31185248"></a>Example application code (in PHP):</h3><pre class="programlisting">
  1017. // only search posts by author whose ID is 123
  1018. $cl-&gt;SetFilter ( "author_id", array ( 123 ) );
  1019. // only search posts in sub-forums 1, 3 and 7
  1020. $cl-&gt;SetFilter ( "forum_id", array ( 1,3,7 ) );
  1021. // sort found posts by posting date in descending order
  1022. $cl-&gt;SetSortMode ( SPH_SORT_ATTR_DESC, "post_date" );
  1023. </pre><p>
  1024. Attributes are named. Attribute names are case insensitive.
  1025. Attributes are <span class="emphasis"><em>not</em></span> full-text indexed; they are stored in the index as is.
  1026. Currently supported attribute types are:
  1027. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>unsigned integers (1-bit to 32-bit wide);</p></li>
  1028. <li class="listitem"><p>UNIX timestamps;</p></li>
  1029. <li class="listitem"><p>floating point values (32-bit, IEEE 754 single precision);</p></li>
  1030. <li class="listitem"><p><a class="link" href="#conf-sql-attr-string" title="12.1.23.&nbsp;sql_attr_string">strings</a> (since 1.10-beta);</p></li>
  1031. <li class="listitem"><p><a class="link" href="#conf-sql-attr-json" title="12.1.24.&nbsp;sql_attr_json">JSON</a> (since 2.1.1-beta);</p></li>
  1032. <li class="listitem"><p><a class="link" href="#mva" title="3.4.&nbsp;MVA (multi-valued attributes)">MVA</a>, multi-value attributes (variable-length lists of 32-bit unsigned integers).</p></li>
  1033. </ul></div>
  1034. <p>
  1035. </p><p>
  1036. The complete set of per-document attribute values is sometimes
  1037. referred to as <em class="glossterm">docinfo</em>. Docinfos can either be
  1038. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>stored separately from the main full-text index data ("extern" storage, in <code class="filename">.spa</code> file), or</p></li>
  1039. <li class="listitem"><p>attached to each occurrence of document ID in full-text index data ("inline" storage, in <code class="filename">.spd</code> file).</p></li>
  1040. </ul></div>
  1041. <p>
  1042. </p><p>
  1043. When using extern storage, a copy of <code class="filename">.spa</code> file
  1044. (with all the attribute values for all the documents) is kept in RAM by
  1045. <code class="filename">searchd</code> at all times. This is for performance reasons;
  1046. random disk I/O would be too slow. On the contrary, inline storage does not
  1047. require any additional RAM at all, but that comes at the cost of greatly
  1048. inflating the index size: remember that it copies <span class="emphasis"><em>all</em></span>
  1049. attribute value <span class="emphasis"><em>every</em></span> time when the document ID
  1050. is mentioned, and that is exactly as many times as there are
  1051. different keywords in the document. Inline may be the only viable
  1052. option if you have only a few attributes and need to work with big
  1053. datasets in limited RAM. However, in most cases extern storage
  1054. makes both indexing and searching <span class="emphasis"><em>much</em></span> more efficient.
  1055. </p><p>
  1056. Search-time memory requirements for extern storage are
  1057. (1+number_of_attrs)*number_of_docs*4 bytes, ie. 10 million docs with
  1058. 2 groups and 1 timestamp will take (1+2+1)*10M*4 = 160 MB of RAM.
  1059. This is <span class="emphasis"><em>PER DAEMON</em></span>, not per query. <code class="filename">searchd</code>
  1060. will allocate 160 MB on startup, read the data and keep it shared between queries.
  1061. The children will <span class="emphasis"><em>NOT</em></span> allocate any additional
  1062. copies of this data.
  1063. </p></div>
  1064. <div class="sect1" title="3.4.&nbsp;MVA (multi-valued attributes)"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="mva"></a>3.4.&nbsp;MVA (multi-valued attributes)</h2></div></div></div>
  1065. <p>
  1066. MVAs, or multi-valued attributes, are an important special type of per-document attributes in Sphinx.
  1067. MVAs let you attach sets of numeric values to every document.
  1068. That is useful to implement article tags, product categories, etc.
  1069. Filtering and group-by (but not sorting) on MVA attributes is supported.
  1070. </p><p>
  1071. As of version 2.0.2-beta, MVA values can either be unsigned 32-bit integers
  1072. (UNSIGNED INTEGER) or signed 64-bit integers (BIGINT). Up to version 2.0.1-beta,
  1073. only the unsigned 32-bit values were supported.
  1074. </p><p>
  1075. The set size is not limited, you can have an arbitrary number of values
  1076. attached to each document as long as RAM permits (<code class="filename">.spm</code> file
  1077. that contains the MVA values will be precached in RAM by <code class="filename">searchd</code>).
  1078. The source data can be taken either from a separate query, or from a document field;
  1079. see source type in <a class="link" href="#conf-sql-attr-multi" title="12.1.22.&nbsp;sql_attr_multi">sql_attr_multi</a>.
  1080. In the first case the query will have to return pairs of document ID and MVA values,
  1081. in the second one the field will be parsed for integer values.
  1082. There are absolutely no requirements as to incoming data order; the values will be
  1083. automatically grouped by document ID (and internally sorted within the same ID)
  1084. during indexing anyway.
  1085. </p><p>
  1086. When filtering, a document will match the filter on MVA attribute
  1087. if <span class="emphasis"><em>any</em></span> of the values satisfy the filtering condition.
  1088. (Therefore, documents that pass through exclude filters will not
  1089. contain any of the forbidden values.)
  1090. When grouping by MVA attribute, a document will contribute to as
  1091. many groups as there are different MVA values associated with that document.
  1092. For instance, if the collection contains exactly 1 document having a 'tag' MVA
  1093. with values 5, 7, and 11, grouping on 'tag' will produce 3 groups with
  1094. 'COUNT(*)' equal to 1 and 'GROUPBY()' key values of 5, 7, and 11 respectively.
  1095. Also note that grouping by MVA might lead to duplicate documents in the result set:
  1096. because each document can participate in many groups, it can be chosen as the best
  1097. one in in more than one group, leading to duplicate IDs. PHP API historically
  1098. uses ordered hash on the document ID for the resulting rows; so you'll also need to use
  1099. <a class="link" href="#api-func-setarrayresult" title="9.1.6.&nbsp;SetArrayResult">SetArrayResult()</a> in order
  1100. to employ group-by on MVA with PHP API.
  1101. </p></div>
  1102. <div class="sect1" title="3.5.&nbsp;Indexes"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="indexes"></a>3.5.&nbsp;Indexes</h2></div></div></div>
  1103. <p>
  1104. To be able to answer full-text search queries fast, Sphinx needs
  1105. to build a special data structure optimized for such queries from
  1106. your text data. This structure is called <em class="glossterm">index</em>; and
  1107. the process of building index from text is called <em class="glossterm">indexing</em>.
  1108. </p><p>
  1109. Different index types are well suited for different tasks.
  1110. For example, a disk-based tree-based index would be easy to
  1111. update (ie. insert new documents to existing index), but rather
  1112. slow to search. Sphinx architecture allows internally for different
  1113. <em class="glossterm">index types</em>, or <em class="glossterm">backends</em>,
  1114. to be implemented comparatively easily.
  1115. </p><p>
  1116. Starting with 1.10-beta, Sphinx provides 2 different backends:
  1117. a <span class="bold"><strong>disk index</strong></span> backend, and a <span class="bold"><strong>RT (realtime) index</strong></span> backend.
  1118. </p><p>
  1119. <span class="bold"><strong>Disk indexes</strong></span> are designed to provide maximum indexing and searching
  1120. speed, while keeping the RAM footprint as low as possible. That comes
  1121. at a cost of text index updates. You can not update an existing document or
  1122. incrementally add a new document to a disk index. You only can batch
  1123. rebuild the entire disk index from scratch. (Note that you still can
  1124. update document's <span class="bold"><strong>attributes</strong></span> on the fly, even with the disk
  1125. indexes.)
  1126. </p><p>
  1127. This "rebuild only" limitation might look as a big constraint
  1128. at a first glance. But in reality, it can very frequently be worked
  1129. around rather easily by setting up multiple disk indexes, searching
  1130. through them all, and only rebuilding the one with a fraction
  1131. of the most recently changed data.
  1132. See <a class="xref" href="#live-updates" title="3.11.&nbsp;Live index updates">Section&nbsp;3.11, &#8220;Live index updates&#8221;</a> for details.
  1133. </p><p>
  1134. <span class="bold"><strong>RT indexes</strong></span> enable you to implement dynamic updates and
  1135. incremental additions to the full text index. RT stands for Real Time
  1136. and they are indeed "soft realtime" in terms of writes, meaning that
  1137. most index changes become available for searching as quick as 1 millisecond
  1138. or less, but could occasionally stall for seconds. (Searches will still work
  1139. even during that occasional writing stall.) Refer to
  1140. <a class="xref" href="#rt-indexes" title="Chapter&nbsp;4.&nbsp;Real-time indexes">Chapter&nbsp;4, <i>Real-time indexes</i></a> for details.
  1141. </p><p>
  1142. Last but not least, Sphinx supports so-called <span class="bold"><strong>distributed indexes</strong></span>.
  1143. Compared to disk and RT indexes, those are not a real physical backend,
  1144. but rather just lists of either local or remote indexes that can be
  1145. searched transparently to the application, with Sphinx doing all the chores
  1146. of sending search requests to remote machines in the cluster, aggregating
  1147. the result sets, retrying the failed requests, and even doing some
  1148. load balancing. See <a class="xref" href="#distributed" title="5.8.&nbsp;Distributed searching">Section&nbsp;5.8, &#8220;Distributed searching&#8221;</a> for a discussion
  1149. of distributed indexes.
  1150. </p><p>
  1151. There can be as many indexes per configuration file as necessary.
  1152. <code class="filename">indexer</code> utility can reindex either all of them
  1153. (if <code class="option">--all</code> option is specified), or a certain explicitly
  1154. specified subset. <code class="filename">searchd</code> utility will serve all
  1155. the specified indexes, and the clients can specify what indexes to
  1156. search in run time.
  1157. </p></div>
  1158. <div class="sect1" title="3.6.&nbsp;Restrictions on the source data"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="data-restrictions"></a>3.6.&nbsp;Restrictions on the source data</h2></div></div></div>
  1159. <p>
  1160. There are a few different restrictions imposed on the source data
  1161. which is going to be indexed by Sphinx, of which the single most
  1162. important one is:
  1163. </p><p><span class="bold"><strong>
  1164. ALL DOCUMENT IDS MUST BE UNIQUE UNSIGNED NON-ZERO INTEGER NUMBERS (32-BIT OR 64-BIT, DEPENDING ON BUILD TIME SETTINGS).
  1165. </strong></span></p><p>
  1166. If this requirement is not met, different bad things can happen.
  1167. For instance, Sphinx can crash with an internal assertion while indexing;
  1168. or produce strange results when searching due to conflicting IDs.
  1169. Also, a 1000-pound gorilla might eventually come out of your
  1170. display and start throwing barrels at you. You've been warned.
  1171. </p></div>
  1172. <div class="sect1" title="3.7.&nbsp;Charsets, case folding, translation tables, and replacement rules"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="charsets"></a>3.7.&nbsp;Charsets, case folding, translation tables, and replacement rules</h2></div></div></div>
  1173. <p>
  1174. When indexing some index, Sphinx fetches documents from
  1175. the specified sources, splits the text into words, and does
  1176. case folding so that "Abc", "ABC" and "abc" would be treated
  1177. as the same word (or, to be pedantic, <em class="glossterm">term</em>).
  1178. </p><p>
  1179. To do that properly, Sphinx needs to know
  1180. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>what encoding is the source text in (and this encoding should always be UTF-8);</p></li>
  1181. <li class="listitem"><p>what characters are letters and what are not;</p></li>
  1182. <li class="listitem"><p>what letters should be folded to what letters.</p></li>
  1183. </ul></div>
  1184. <p>
  1185. This should be configured on a per-index basis using
  1186. <code class="option"><a class="link" href="#conf-charset-table" title="12.2.16.&nbsp;charset_table">charset_table</a></code> option.
  1187. <code class="option"><a class="link" href="#conf-charset-table" title="12.2.16.&nbsp;charset_table">charset_table</a></code>
  1188. specifies the table that maps letter characters to their case
  1189. folded versions. The characters that are not in the table are considered
  1190. to be non-letters and will be treated as word separators when indexing
  1191. or searching through this index.
  1192. </p><p>
  1193. Default tables currently include English and Russian characters.
  1194. Please do submit your tables for other languages!
  1195. </p><p>As of version 2.1.1-beta, you can also specify text pattern replacement rules.
  1196. For example, given the rules</p><pre class="programlisting">
  1197. regexp_filter = \b(\d+)\" =&gt; \1 inch
  1198. regexp_filter = (BLUE|RED) =&gt; COLOR
  1199. </pre><p>the text 'RED TUBE 5" LONG' would be indexed as 'COLOR TUBE 5 INCH LONG', and
  1200. 'PLANK 2" x 4"' as 'PLANK 2 INCH x 4 INCH'. Rules are applied in the given order.
  1201. Text in queries is also replaced; a search for "BLUE TUBE" would
  1202. actually become a search for "COLOR TUBE". Note that Sphinx must
  1203. be built with the --with-re2 option to use this feature.</p></div>
  1204. <div class="sect1" title="3.8.&nbsp;SQL data sources (MySQL, PostgreSQL)"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sql"></a>3.8.&nbsp;SQL data sources (MySQL, PostgreSQL)</h2></div></div></div>
  1205. <p>
  1206. With all the SQL drivers, indexing generally works as follows.
  1207. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>connection to the database is established;</p></li>
  1208. <li class="listitem"><p>pre-query (see <a class="xref" href="#conf-sql-query-pre" title="12.1.11.&nbsp;sql_query_pre">Section&nbsp;12.1.11, &#8220;sql_query_pre&#8221;</a>) is executed
  1209. to perform any necessary initial setup, such as setting per-connection encoding with MySQL;</p></li>
  1210. <li class="listitem"><p>main query (see <a class="xref" href="#conf-sql-query" title="12.1.12.&nbsp;sql_query">Section&nbsp;12.1.12, &#8220;sql_query&#8221;</a>) is executed and the rows it returns are indexed;</p></li>
  1211. <li class="listitem"><p>post-query (see <a class="xref" href="#conf-sql-query-post" title="12.1.28.&nbsp;sql_query_post">Section&nbsp;12.1.28, &#8220;sql_query_post&#8221;</a>) is executed
  1212. to perform any necessary cleanup;</p></li>
  1213. <li class="listitem"><p>connection to the database is closed;</p></li>
  1214. <li class="listitem"><p>indexer does the sorting phase (to be pedantic, index-type specific post-processing);</p></li>
  1215. <li class="listitem"><p>connection to the database is established again;</p></li>
  1216. <li class="listitem"><p>post-index query (see <a class="xref" href="#conf-sql-query-post-index" title="12.1.29.&nbsp;sql_query_post_index">Section&nbsp;12.1.29, &#8220;sql_query_post_index&#8221;</a>) is executed
  1217. to perform any necessary final cleanup;</p></li>
  1218. <li class="listitem"><p>connection to the database is closed again.</p></li>
  1219. </ul></div>
  1220. <p>
  1221. Most options, such as database user/host/password, are straightforward.
  1222. However, there are a few subtle things, which are discussed in more detail here.
  1223. </p><h3><a name="ranged-queries"></a>Ranged queries</h3><p>
  1224. Main query, which needs to fetch all the documents, can impose
  1225. a read lock on the whole table and stall the concurrent queries
  1226. (eg. INSERTs to MyISAM table), waste a lot of memory for result set, etc.
  1227. To avoid this, Sphinx supports so-called <em class="glossterm">ranged queries</em>.
  1228. With ranged queries, Sphinx first fetches min and max document IDs from
  1229. the table, and then substitutes different ID intervals into main query text
  1230. and runs the modified query to fetch another chunk of documents.
  1231. Here's an example.
  1232. </p><div class="example"><a name="ex-ranged-queries"></a><p class="title"><b>Example&nbsp;3.1.&nbsp;Ranged query usage example</b></p><div class="example-contents"><pre class="programlisting">
  1233. # in sphinx.conf
  1234. sql_query_range = SELECT MIN(id),MAX(id) FROM documents
  1235. sql_range_step = 1000
  1236. sql_query = SELECT * FROM documents WHERE id&gt;=$start AND id&lt;=$end
  1237. </pre></div></div>
  1238. <br class="example-break"><p>
  1239. If the table contains document IDs from 1 to, say, 2345, then sql_query would
  1240. be run three times:
  1241. </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>with <code class="option">$start</code> replaced with 1 and <code class="option">$end</code> replaced with 1000;</p></li>
  1242. <li class="listitem"><p>with <code class="option">$start</code> replaced with 1001 and <code class="option">$end</code> replaced with 2000;</p></li>
  1243. <li class="listitem"><p>with <code class="option">$start</code> replaced with 2001 and <code class="option">$end</code> replaced with 2345.</p></li>
  1244. </ol></div>
  1245. <p>
  1246. Obviously, that's not much of a difference for 2000-row table,
  1247. but when it comes to indexing 10-million-row MyISAM table,
  1248. ranged queries might be of some help.
  1249. </p><h3><a name="idp31253776"></a><code class="option">sql_query_post</code> vs. <code class="option">sql_query_post_index</code></h3><p>
  1250. The difference between post-query and post-index query is in that post-query
  1251. is run immediately when Sphinx received all the documents, but further indexing
  1252. <span class="bold"><strong>may</strong></span> still fail for some other reason. On the contrary,
  1253. by the time the post-index query gets executed, it is <span class="bold"><strong>guaranteed</strong></span>
  1254. that the indexing was successful. Database connection is dropped and re-established
  1255. because sorting phase can be very lengthy and would just timeout otherwise.
  1256. </p></div>
  1257. <div class="sect1" title="3.9.&nbsp;xmlpipe2 data source"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="xmlpipe2"></a>3.9.&nbsp;xmlpipe2 data source</h2></div></div></div>
  1258. <p>
  1259. xmlpipe2 lets you pass arbitrary full-text and attribute data to Sphinx
  1260. in yet another custom XML format. It also allows to specify the schema
  1261. (ie. the set of fields and attributes) either in the XML stream itself,
  1262. or in the source settings.
  1263. </p><p>
  1264. When indexing xmlpipe2 source, indexer runs the given command, opens
  1265. a pipe to its stdout, and expects well-formed XML stream. Here's sample
  1266. stream data:
  1267. </p><div class="example"><a name="ex-xmlpipe2-document"></a><p class="title"><b>Example&nbsp;3.2.&nbsp;xmlpipe2 document stream</b></p><div class="example-contents"><pre class="programlisting">
  1268. &lt;?xml version="1.0" encoding="utf-8"?&gt;
  1269. &lt;sphinx:docset&gt;
  1270. &lt;sphinx:schema&gt;
  1271. &lt;sphinx:field name="subject"/&gt;
  1272. &lt;sphinx:field name="content"/&gt;
  1273. &lt;sphinx:attr name="published" type="timestamp"/&gt;
  1274. &lt;sphinx:attr name="author_id" type="int" bits="16" default="1"/&gt;
  1275. &lt;/sphinx:schema&gt;
  1276. &lt;sphinx:document id="1234"&gt;
  1277. &lt;content&gt;this is the main content &lt;![CDATA[[and this &lt;cdata&gt; entry
  1278. must be handled properly by xml parser lib]]&gt;&lt;/content&gt;
  1279. &lt;published&gt;1012325463&lt;/published&gt;
  1280. &lt;subject&gt;note how field/attr tags can be
  1281. in &lt;b class="red"&gt;randomized&lt;/b&gt; order&lt;/subject&gt;
  1282. &lt;misc&gt;some undeclared element&lt;/misc&gt;
  1283. &lt;/sphinx:document&gt;
  1284. &lt;sphinx:document id="1235"&gt;
  1285. &lt;subject&gt;another subject&lt;/subject&gt;
  1286. &lt;content&gt;here comes another document, and i am given to understand,
  1287. that in-document field order must not matter, sir&lt;/content&gt;
  1288. &lt;published&gt;1012325467&lt;/published&gt;
  1289. &lt;/sphinx:document&gt;
  1290. &lt;!-- ... even more sphinx:document entries here ... --&gt;
  1291. &lt;sphinx:killlist&gt;
  1292. &lt;id&gt;1234&lt;/id&gt;
  1293. &lt;id&gt;4567&lt;/id&gt;
  1294. &lt;/sphinx:killlist&gt;
  1295. &lt;/sphinx:docset&gt;
  1296. </pre></div></div>
  1297. <p><br class="example-break">
  1298. </p><p>
  1299. Arbitrary fields and attributes are allowed.
  1300. They also can occur in the stream in arbitrary order within each document; the order is ignored.
  1301. There is a restriction on maximum field length; fields longer than 2 MB will be truncated to 2 MB (this limit can be changed in the source).
  1302. </p><p>
  1303. The schema, ie. complete fields and attributes list, must be declared
  1304. before any document could be parsed. This can be done either in the
  1305. configuration file using <code class="option">xmlpipe_field</code> and <code class="option">xmlpipe_attr_XXX</code>
  1306. settings, or right in the stream using &lt;sphinx:schema&gt; element.
  1307. &lt;sphinx:schema&gt; is optional. It is only allowed to occur as the very
  1308. first sub-element in &lt;sphinx:docset&gt;. If there is no in-stream
  1309. schema definition, settings from the configuration file will be used.
  1310. Otherwise, stream settings take precedence.
  1311. </p><p>
  1312. Unknown tags (which were not declared neither as fields nor as attributes)
  1313. will be ignored with a warning. In the example above, &lt;misc&gt; will be ignored.
  1314. All embedded tags and their attributes (such as &lt;b&gt; in &lt;subject&gt;
  1315. in the example above) will be silently ignored.
  1316. </p><p>
  1317. Support for incoming stream encodings depends on whether <code class="filename">iconv</code>
  1318. is installed on the system. xmlpipe2 is parsed using <code class="filename">libexpat</code>
  1319. parser that understands US-ASCII, ISO-8859-1, UTF-8 and a few UTF-16 variants
  1320. natively. Sphinx <code class="filename">configure</code> script will also check
  1321. for <code class="filename">libiconv</code> presence, and utilize it to handle
  1322. other encodings. <code class="filename">libexpat</code> also enforces the
  1323. requirement to use UTF-8 charset on Sphinx side, because the
  1324. parsed data it returns is always in UTF-8.
  1325. </p><p>
  1326. XML elements (tags) recognized by xmlpipe2 (and their attributes where applicable) are:
  1327. </p><div class="variablelist"><dl><dt><span class="term">sphinx:docset</span></dt>
  1328. <dd><p>Mandatory top-level element, denotes and contains xmlpipe2 document set.</p></dd><dt><span class="term">sphinx:schema</span></dt>
  1329. <dd><p>Optional element, must either occur as the very first child
  1330. of sphinx:docset, or never occur at all. Declares the document schema.
  1331. Contains field and attribute declarations. If present, overrides
  1332. per-source settings from the configuration file.
  1333. </p></dd><dt><span class="term">sphinx:field</span></dt>
  1334. <dd><p>Optional element, child of sphinx:schema. Declares a full-text field.
  1335. Known attributes are:
  1336. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>"name", specifies the XML element name that will be treated as a full-text field in the subsequent documents.</p></li>
  1337. <li class="listitem"><p>"attr", specifies whether to also index this field as a string. Possible value is "string". Introduced in version 1.10-beta.</p></li>
  1338. </ul></div>
  1339. <p>
  1340. </p></dd><dt><span class="term">sphinx:attr</span></dt>
  1341. <dd><p>Optional element, child of sphinx:schema. Declares an attribute.
  1342. Known attributes are:
  1343. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>"name", specifies the element name that should be treated as an attribute in the subsequent documents.</p></li>
  1344. <li class="listitem"><p>"type", specifies the attribute type. Possible values are "int", "bigint", "timestamp", "bool", "float", "multi" and "json".</p></li>
  1345. <li class="listitem"><p>"bits", specifies the bit size for "int" attribute type. Valid values are 1 to 32.</p></li>
  1346. <li class="listitem"><p>"default", specifies the default value for this attribute that should be used if the attribute's element is not present in the document.</p></li>
  1347. </ul></div>
  1348. <p>
  1349. </p></dd><dt><span class="term">sphinx:document</span></dt>
  1350. <dd><p>Mandatory element, must be a child of sphinx:docset.
  1351. Contains arbitrary other elements with field and attribute values
  1352. to be indexed, as declared either using sphinx:field and sphinx:attr
  1353. elements or in the configuration file. The only known attribute
  1354. is "id" that must contain the unique integer document ID.
  1355. </p></dd><dt><span class="term">sphinx:killlist</span></dt>
  1356. <dd><p>Optional element, child of sphinx:docset.
  1357. Contains a number of "id" elements whose contents are document IDs
  1358. to be put into a <a class="link" href="#conf-sql-query-killlist" title="12.1.16.&nbsp;sql_query_killlist">kill-list</a> for this index.
  1359. </p></dd></dl></div>
  1360. <p>
  1361. </p></div>
  1362. <div class="sect1" title="3.10.&nbsp;tsvpipe (Tab Separated Values) data source"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="tsvpipe"></a>3.10.&nbsp;tsvpipe (Tab Separated Values) data source</h2></div></div></div>
  1363. <p>
  1364. This is the simplest way to pass data to the indexer. It was created due to
  1365. xmlpipe2 limitations. Namely, indexer must map each attribute and field tag
  1366. in XML file to corresponding schema element. This mapping requires some time.
  1367. And time increases with increasing the number of fields and attributes in
  1368. schema. There is no such issue in tsvpipe because each field and attribute
  1369. is a particular column in TSV file. So, in some cases tsvpipe could work
  1370. slightly faster than xmlpipe2. Added in 2.2.1-beta.
  1371. </p><p>
  1372. The first column in TSV file must be a document ID. The rest ones must mirror
  1373. the declaration of fields and attributes in schema definition.
  1374. </p><pre class="programlisting">
  1375. source tsv_test
  1376. {
  1377. type = tsvpipe
  1378. tsvpipe_command = cat /tmp/rock_bands.tsv
  1379. tsvpipe_field = name
  1380. tsvpipe_attr_multi = genre_tags
  1381. }
  1382. </pre><pre class="programlisting">
  1383. 1 Led Zeppelin 35,23,16
  1384. 2 Deep Purple 35,92
  1385. 3 Frank Zappa 35,23,16,92,33,24
  1386. </pre></div>
  1387. <div class="sect1" title="3.11.&nbsp;Live index updates"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="live-updates"></a>3.11.&nbsp;Live index updates</h2></div></div></div>
  1388. <p>
  1389. There are two major approaches to maintaining the full-text index
  1390. contents up to date. Note, however, that both these approaches deal
  1391. with the task of <span class="emphasis"><em>full-text data updates</em></span>, and not
  1392. attribute updates. Instant attribute updates are supported since
  1393. version 0.9.8. Refer to <a class="link" href="#api-func-updateatttributes" title="9.7.2.&nbsp;UpdateAttributes">UpdateAttributes()</a>
  1394. API call description for details.
  1395. </p><p>
  1396. First, you can use disk-based indexes, partition them manually,
  1397. and only rebuild the smaller partitions (so-called "deltas") frequently.
  1398. By minimizing the rebuild size, you can reduce the average indexing lag
  1399. to something as low as 30-60 seconds. This approach was the the only one
  1400. available in versions 0.9.x. On huge collections it actually might be
  1401. the most efficient one. Refer to <a class="xref" href="#delta-updates" title="3.12.&nbsp;Delta index updates">Section&nbsp;3.12, &#8220;Delta index updates&#8221;</a>
  1402. for details.
  1403. </p><p>
  1404. Second, versions 1.x (starting with 1.10-beta) add support for so-called
  1405. real-time indexes (RT indexes for short) that on-the-fly updates of the
  1406. full-text data. Updates on a RT index can appear in the search results in
  1407. 1-2 milliseconds, ie. 0.001-0.002 seconds. However, RT index are less
  1408. efficient for bulk indexing huge amounts of data. Refer to
  1409. <a class="xref" href="#rt-indexes" title="Chapter&nbsp;4.&nbsp;Real-time indexes">Chapter&nbsp;4, <i>Real-time indexes</i></a> for details.
  1410. </p></div>
  1411. <div class="sect1" title="3.12.&nbsp;Delta index updates"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="delta-updates"></a>3.12.&nbsp;Delta index updates</h2></div></div></div>
  1412. <p>
  1413. There's a frequent situation when the total dataset is too big
  1414. to be reindexed from scratch often, but the amount of new records
  1415. is rather small. Example: a forum with a 1,000,000 archived posts,
  1416. but only 1,000 new posts per day.
  1417. </p><p>
  1418. In this case, "live" (almost real time) index updates could be
  1419. implemented using so called "main+delta" scheme.
  1420. </p><p>
  1421. The idea is to set up two sources and two indexes, with one
  1422. "main" index for the data which only changes rarely (if ever),
  1423. and one "delta" for the new documents. In the example above,
  1424. 1,000,000 archived posts would go to the main index, and newly
  1425. inserted 1,000 posts/day would go to the delta index. Delta index
  1426. could then be reindexed very frequently, and the documents can
  1427. be made available to search in a matter of minutes.
  1428. </p><p>
  1429. Specifying which documents should go to what index and
  1430. reindexing main index could also be made fully automatic.
  1431. One option would be to make a counter table which would track
  1432. the ID which would split the documents, and update it
  1433. whenever the main index is reindexed.
  1434. </p><div class="example"><a name="ex-live-updates"></a><p class="title"><b>Example&nbsp;3.3.&nbsp;Fully automated live updates</b></p><div class="example-contents"><pre class="programlisting">
  1435. # in MySQL
  1436. CREATE TABLE sph_counter
  1437. (
  1438. counter_id INTEGER PRIMARY KEY NOT NULL,
  1439. max_doc_id INTEGER NOT NULL
  1440. );
  1441. # in sphinx.conf
  1442. source main
  1443. {
  1444. # ...
  1445. sql_query_pre = SET NAMES utf8
  1446. sql_query_pre = REPLACE INTO sph_counter SELECT 1, MAX(id) FROM documents
  1447. sql_query = SELECT id, title, body FROM documents \
  1448. WHERE id&lt;=( SELECT max_doc_id FROM sph_counter WHERE counter_id=1 )
  1449. }
  1450. source delta : main
  1451. {
  1452. sql_query_pre = SET NAMES utf8
  1453. sql_query = SELECT id, title, body FROM documents \
  1454. WHERE id&gt;( SELECT max_doc_id FROM sph_counter WHERE counter_id=1 )
  1455. }
  1456. index main
  1457. {
  1458. source = main
  1459. path = /path/to/main
  1460. # ... all the other settings
  1461. }
  1462. # note how all other settings are copied from main,
  1463. # but source and path are overridden (they MUST be)
  1464. index delta : main
  1465. {
  1466. source = delta
  1467. path = /path/to/delta
  1468. }
  1469. </pre></div></div>
  1470. <p><br class="example-break">
  1471. </p><p>
  1472. Note how we're overriding <code class="code">sql_query_pre</code> in the delta source.
  1473. We need to explicitly have that override. Otherwise <code class="code">REPLACE</code> query
  1474. would be run when indexing delta source too, effectively nullifying it. However,
  1475. when we issue the directive in the inherited source for the first time, it removes
  1476. <span class="emphasis"><em>all</em></span> inherited values, so the encoding setup is also lost.
  1477. So <code class="code">sql_query_pre</code> in the delta can not just be empty; and we need
  1478. to issue the encoding setup query explicitly once again.
  1479. </p></div>
  1480. <div class="sect1" title="3.13.&nbsp;Index merging"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="index-merging"></a>3.13.&nbsp;Index merging</h2></div></div></div>
  1481. <p>
  1482. Merging two existing indexes can be more efficient that indexing the data
  1483. from scratch, and desired in some cases (such as merging 'main' and 'delta'
  1484. indexes instead of simply reindexing 'main' in 'main+delta' partitioning
  1485. scheme). So <code class="filename">indexer</code> has an option to do that.
  1486. Merging the indexes is normally faster than reindexing but still
  1487. <span class="emphasis"><em>not</em></span> instant on huge indexes. Basically,
  1488. it will need to read the contents of both indexes once and write
  1489. the result once. Merging 100 GB and 1 GB index, for example,
  1490. will result in 202 GB of IO (but that's still likely less than
  1491. the indexing from scratch requires).
  1492. </p><p>
  1493. The basic command syntax is as follows:
  1494. </p><pre class="programlisting">
  1495. indexer --merge DSTINDEX SRCINDEX [--rotate]
  1496. </pre><p>
  1497. Only the DSTINDEX index will be affected: the contents of SRCINDEX will be merged into it.
  1498. <code class="option">--rotate</code> switch will be required if DSTINDEX is already being served by <code class="filename">searchd</code>.
  1499. The initially devised usage pattern is to merge a smaller update from SRCINDEX into DSTINDEX.
  1500. Thus, when merging the attributes, values from SRCINDEX will win if duplicate document IDs are encountered.
  1501. Note, however, that the "old" keywords will <span class="emphasis"><em>not</em></span> be automatically removed in such cases.
  1502. For example, if there's a keyword "old" associated with document 123 in DSTINDEX, and a keyword "new" associated
  1503. with it in SRCINDEX, document 123 will be found by <span class="emphasis"><em>both</em></span> keywords after the merge.
  1504. You can supply an explicit condition to remove documents from DSTINDEX to mitigate that;
  1505. the relevant switch is <code class="option">--merge-dst-range</code>:
  1506. </p><pre class="programlisting">
  1507. indexer --merge main delta --merge-dst-range deleted 0 0
  1508. </pre><p>
  1509. This switch lets you apply filters to the destination index along with merging.
  1510. There can be several filters; all of their conditions must be met in order
  1511. to include the document in the resulting merged index. In the example above,
  1512. the filter passes only those records where 'deleted' is 0, eliminating all
  1513. records that were flagged as deleted (for instance, using
  1514. <a class="link" href="#api-func-updateatttributes" title="9.7.2.&nbsp;UpdateAttributes">UpdateAttributes()</a> call).
  1515. </p></div></div>
  1516. <div class="chapter" title="Chapter&nbsp;4.&nbsp;Real-time indexes"><div class="titlepage"><div><div><h2 class="title"><a name="rt-indexes"></a>Chapter&nbsp;4.&nbsp;Real-time indexes</h2></div></div></div>
  1517. <div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#rt-overview">4.1. RT indexes overview</a></span></dt>
  1518. <dt><span class="sect1"><a href="#rt-caveats">4.2. Known caveats with RT indexes</a></span></dt>
  1519. <dt><span class="sect1"><a href="#rt-internals">4.3. RT index internals</a></span></dt>
  1520. <dt><span class="sect1"><a href="#rt-binlog">4.4. Binary logging</a></span></dt>
  1521. </dl></div>
  1522. <p>
  1523. Real-time indexes (or RT indexes for brevity) are a new backend
  1524. that lets you insert, update, or delete documents (rows) on the fly.
  1525. RT indexes were added in version 1.10-beta. While querying of RT indexes
  1526. is possible using any of the SphinxAPI, SphinxQL, or SphinxSE, updating
  1527. them is only possible via SphinxQL at the moment. Full SphinxQL
  1528. reference is available in <a class="xref" href="#sphinxql-reference" title="Chapter&nbsp;8.&nbsp;SphinxQL reference">Chapter&nbsp;8, <i>SphinxQL reference</i></a>.
  1529. </p><div class="sect1" title="4.1.&nbsp;RT indexes overview"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rt-overview"></a>4.1.&nbsp;RT indexes overview</h2></div></div></div>
  1530. <p>
  1531. RT indexes should be declared in <code class="filename">sphinx.conf</code>,
  1532. just as every other index type. Notable differences from the regular,
  1533. disk-based indexes are that a) data sources are not required and ignored,
  1534. and b) you should explicitly enumerate all the text fields, not just
  1535. attributes. Here's an example:
  1536. </p><div class="example"><a name="ex-rt-updates"></a><p class="title"><b>Example&nbsp;4.1.&nbsp;RT index declaration</b></p><div class="example-contents"><pre class="programlisting">
  1537. index rt
  1538. {
  1539. type = rt
  1540. path = /usr/local/sphinx/data/rt
  1541. rt_field = title
  1542. rt_field = content
  1543. rt_attr_uint = gid
  1544. }
  1545. </pre></div></div>
  1546. <br class="example-break"><p>
  1547. As of 2.0.1-beta and above, RT indexes are production quality,
  1548. despite a few missing features.
  1549. </p><p>
  1550. RT index can be accessed using MySQL protocol. INSERT, REPLACE, DELETE, and
  1551. SELECT statements against RT index are supported. For instance, this
  1552. is an example session with the sample index above:
  1553. </p><pre class="programlisting">
  1554. $ mysql -h 127.0.0.1 -P 9306
  1555. Welcome to the MySQL monitor. Commands end with ; or \g.
  1556. Your MySQL connection id is 1
  1557. Server version: 1.10-dev (r2153)
  1558. Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
  1559. mysql&gt; INSERT INTO rt VALUES ( 1, 'first record', 'test one', 123 );
  1560. Query OK, 1 row affected (0.05 sec)
  1561. mysql&gt; INSERT INTO rt VALUES ( 2, 'second record', 'test two', 234 );
  1562. Query OK, 1 row affected (0.00 sec)
  1563. mysql&gt; SELECT * FROM rt;
  1564. +------+--------+------+
  1565. | id | weight | gid |
  1566. +------+--------+------+
  1567. | 1 | 1 | 123 |
  1568. | 2 | 1 | 234 |
  1569. +------+--------+------+
  1570. 2 rows in set (0.02 sec)
  1571. mysql&gt; SELECT * FROM rt WHERE MATCH('test');
  1572. +------+--------+------+
  1573. | id | weight | gid |
  1574. +------+--------+------+
  1575. | 1 | 1643 | 123 |
  1576. | 2 | 1643 | 234 |
  1577. +------+--------+------+
  1578. 2 rows in set (0.01 sec)
  1579. mysql&gt; SELECT * FROM rt WHERE MATCH('@title test');
  1580. Empty set (0.00 sec)
  1581. </pre><p>
  1582. Both partial and batch INSERT syntaxes are supported, ie.
  1583. you can specify a subset of columns, and insert several rows at a time.
  1584. Deletions are also possible using DELETE statement; the only currently
  1585. supported syntax is DELETE FROM &lt;index&gt; WHERE id=&lt;id&gt;.
  1586. REPLACE is also supported, enabling you to implement updates.
  1587. </p><pre class="programlisting">
  1588. mysql&gt; INSERT INTO rt ( id, title ) VALUES ( 3, 'third row' ), ( 4, 'fourth entry' );
  1589. Query OK, 2 rows affected (0.01 sec)
  1590. mysql&gt; SELECT * FROM rt;
  1591. +------+--------+------+
  1592. | id | weight | gid |
  1593. +------+--------+------+
  1594. | 1 | 1 | 123 |
  1595. | 2 | 1 | 234 |
  1596. | 3 | 1 | 0 |
  1597. | 4 | 1 | 0 |
  1598. +------+--------+------+
  1599. 4 rows in set (0.00 sec)
  1600. mysql&gt; DELETE FROM rt WHERE id=2;
  1601. Query OK, 0 rows affected (0.00 sec)
  1602. mysql&gt; SELECT * FROM rt WHERE MATCH('test');
  1603. +------+--------+------+
  1604. | id | weight | gid |
  1605. +------+--------+------+
  1606. | 1 | 1500 | 123 |
  1607. +------+--------+------+
  1608. 1 row in set (0.00 sec)
  1609. mysql&gt; INSERT INTO rt VALUES ( 1, 'first record on steroids', 'test one', 123 );
  1610. ERROR 1064 (42000): duplicate id '1'
  1611. mysql&gt; REPLACE INTO rt VALUES ( 1, 'first record on steroids', 'test one', 123 );
  1612. Query OK, 1 row affected (0.01 sec)
  1613. mysql&gt; SELECT * FROM rt WHERE MATCH('steroids');
  1614. +------+--------+------+
  1615. | id | weight | gid |
  1616. +------+--------+------+
  1617. | 1 | 1500 | 123 |
  1618. +------+--------+------+
  1619. 1 row in set (0.01 sec)
  1620. </pre><p>
  1621. Data stored in RT index should survive clean shutdown. When binary logging
  1622. is enabled, it should also survive crash and/or dirty shutdown, and recover
  1623. on subsequent startup.
  1624. </p></div>
  1625. <div class="sect1" title="4.2.&nbsp;Known caveats with RT indexes"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rt-caveats"></a>4.2.&nbsp;Known caveats with RT indexes</h2></div></div></div>
  1626. <p>
  1627. RT indexes are currently quality feature, but there are still a few known
  1628. usage quirks. Those quirks are listed in this section.
  1629. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Prefix indexing is supported with dict = keywords starting 2.0.2-beta. Infix indexing is experimental in trunk.</p></li>
  1630. <li class="listitem"><p>Disk chunks optimization routine is not implemented yet.</p></li>
  1631. <li class="listitem"><p>On initial index creation, attributes are reordered by type,
  1632. in the following order: uint, bigint, float, timestamp, string. So when
  1633. using INSERT without an explicit column names list, specify all uint
  1634. column values first, then bigint, etc.</p></li>
  1635. <li class="listitem"><p>Default conservative RAM chunk limit (<code class="option">rt_mem_limit</code>)
  1636. of 32M can lead to poor performance on bigger indexes, you should raise it to
  1637. 256..1024M if you're planning to index gigabytes.</p></li>
  1638. <li class="listitem"><p>High DELETE/REPLACE rate can lead to kill-list fragmentation
  1639. and impact searching performance.</p></li>
  1640. <li class="listitem"><p>No transaction size limits are currently imposed;
  1641. too many concurrent INSERT/REPLACE transactions might therefore
  1642. consume a lot of RAM.</p></li>
  1643. <li class="listitem"><p>In case of a damaged binlog, recovery will stop on the
  1644. first damaged transaction, even though it's technically possible
  1645. to keep looking further for subsequent undamaged transactions, and
  1646. recover those. This mid-file damage case (due to flaky HDD/CDD/tape?)
  1647. is supposed to be extremely rare, though.</p></li>
  1648. <li class="listitem"><p>Multiple INSERTs grouped in a single transaction perform
  1649. better than equivalent single-row transactions and are recommended for
  1650. batch loading of data.</p></li>
  1651. </ul></div></div>
  1652. <div class="sect1" title="4.3.&nbsp;RT index internals"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rt-internals"></a>4.3.&nbsp;RT index internals</h2></div></div></div>
  1653. <p>
  1654. RT index is internally chunked. It keeps a so-called RAM chunk
  1655. that stores all the most recent changes. RAM chunk memory usage
  1656. is rather strictly limited with per-index
  1657. <a class="link" href="#conf-rt-mem-limit" title="12.2.49.&nbsp;rt_mem_limit">rt_mem_limit</a> directive.
  1658. Once RAM chunk grows over this limit, a new disk chunk is created
  1659. from its data, and RAM chunk is reset. Thus, while most changes
  1660. on the RT index will be performed in RAM only and complete instantly
  1661. (in milliseconds), those changes that overflow the RAM chunk will
  1662. stall for the duration of disk chunk creation (a few seconds).
  1663. </p><p>
  1664. Since version 2.1.1-beta, Sphinx uses double-buffering to avoid INSERT stalls. When data is
  1665. being dumped to disk, the second buffer is used, so further INSERTs
  1666. won't be delayed. The second buffer is defined to be 10% the size
  1667. of the standard buffer, <a class="link" href="#conf-rt-mem-limit" title="12.2.49.&nbsp;rt_mem_limit">rt_mem_limit</a>,
  1668. but future versions of Sphinx may allow configuring this further.
  1669. </p><p>
  1670. Disk chunks are, in fact, just regular disk-based indexes.
  1671. But they're a part of an RT index and automatically managed by it,
  1672. so you need not configure nor manage them manually. Because a new
  1673. disk chunk is created every time RT chunk overflows the limit, and
  1674. because in-memory chunk format is close to on-disk format, the disk
  1675. chunks will be approximately <code class="option">rt_mem_limit</code> bytes
  1676. in size each.
  1677. </p><p>
  1678. Generally, it is better to set the limit bigger, to minimize both
  1679. the frequency of flushes, and the index fragmentation (number of disk
  1680. chunks). For instance, on a dedicated search server that handles
  1681. a big RT index, it can be advised to set <code class="option">rt_mem_limit</code>
  1682. to 1-2 GB. A global limit on all indexes is also planned, but not yet
  1683. implemented yet as of 1.10-beta.
  1684. </p><p>
  1685. Disk chunk full-text index data can not be actually modified,
  1686. so the full-text field changes (ie. row deletions and updates)
  1687. suppress a previous row version from a disk chunk using a kill-list,
  1688. but do not actually physically purge the data. Therefore, on workloads
  1689. with high full-text updates ratio index might eventually get polluted
  1690. by these previous row versions, and searching performance would
  1691. degrade. Physical index purging that would improve the performance
  1692. is planned, but not yet implemented as of 1.10-beta.
  1693. </p><p>
  1694. Data in RAM chunk gets saved to disk on clean daemon shutdown, and
  1695. then loaded back on startup. However, on daemon or server crash,
  1696. updates from RAM chunk might be lost. To prevent that, binary logging
  1697. of transactions can be used; see <a class="xref" href="#rt-binlog" title="4.4.&nbsp;Binary logging">Section&nbsp;4.4, &#8220;Binary logging&#8221;</a> for details.
  1698. </p><p>
  1699. Full-text changes in RT index are transactional. They are stored
  1700. in a per-thread accumulator until COMMIT, then applied at once.
  1701. Bigger batches per single COMMIT should result in faster indexing.
  1702. </p></div>
  1703. <div class="sect1" title="4.4.&nbsp;Binary logging"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rt-binlog"></a>4.4.&nbsp;Binary logging</h2></div></div></div>
  1704. <p>
  1705. Binary logs are essentially a recovery mechanism. With binary logs
  1706. enabled, <code class="filename">searchd</code> writes every given transaction
  1707. to the binlog file, and uses that for recovery after an unclean shutdown.
  1708. On clean shutdown, RAM chunks are saved to disk, and then all the binlog
  1709. files are unlinked.
  1710. </p><p>
  1711. During normal operation, a new binlog file will be opened every time
  1712. when <code class="option">binlog_max_log_size</code> limit
  1713. is reached. Older, already closed binlog files are kept until all of the
  1714. transactions stored in them (from all indexes) are flushed as a disk chunk.
  1715. Setting the limit to 0 pretty much prevents binlog from being unlinked
  1716. at all while <code class="filename">searchd</code> is running; however, it will
  1717. still be unlinked on clean shutdown. (This is the default case as of
  1718. 2.0.3-release, <code class="option">binlog_max_log_size</code> defaults to 0.)
  1719. </p><p>
  1720. There are 3 different binlog flushing strategies, controlled by
  1721. <a class="link" href="#conf-binlog-flush" title="12.4.26.&nbsp;binlog_flush">binlog_flush</a> directive
  1722. which takes the values of 0, 1, or 2. 0 means to flush the log
  1723. to OS and sync it to disk every second; 1 means flush and sync
  1724. every transaction; and 2 (the default mode) means flush every
  1725. transaction but sync every second. Sync is relatively slow because
  1726. it has to perform physical disk writes, so mode 1 is the safest
  1727. (every committed transaction is guaranteed to be written on disk)
  1728. but the slowest. Flushing log to OS prevents from data loss on
  1729. <code class="filename">searchd</code> crashes but not system crashes.
  1730. Mode 2 is the default.
  1731. </p><p>
  1732. On recovery after an unclean shutdown, binlogs are replayed
  1733. and all logged transactions since the last good on-disk state
  1734. are restored. Transactions are checksummed so in case of binlog
  1735. file corruption garbage data will <span class="bold"><strong>not</strong></span> be replayed; such
  1736. a broken transaction will be detected and, currently, will stop
  1737. replay. Transactions also start with a magic marker and timestamped,
  1738. so in case of binlog damage in the middle of the file, it's technically
  1739. possible to skip broken transactions and keep replaying from the next
  1740. good one, and/or it's possible to replay transactions until a given
  1741. timestamp (point-in-time recovery), but none of that is implemented yet
  1742. as of 1.10-beta.
  1743. </p><p>
  1744. One unwanted side effect of binlogs is that actively updating
  1745. a small RT index that fully fits into a RAM chunk part will lead
  1746. to an ever-growing binlog that can never be unlinked until clean
  1747. shutdown. Binlogs are essentially append-only deltas against
  1748. the last known good saved state on disk, and unless RAM chunk
  1749. gets saved, they can not be unlinked. An ever-growing binlog
  1750. is not very good for disk use and crash recovery time. Starting
  1751. with 2.0.1-beta you can configure <code class="filename">searchd</code>
  1752. to perform a periodic RAM chunk flush to fix that problem
  1753. using a <a class="link" href="#conf-rt-flush-period" title="12.4.33.&nbsp;rt_flush_period">rt_flush_period</a>
  1754. directive. With periodic flushes enabled, <code class="filename">searchd</code>
  1755. will keep a separate thread, checking whether RT indexes RAM
  1756. chunks need to be written back to disk. Once that happens,
  1757. the respective binlogs can be (and are) safely unlinked.
  1758. </p><p>
  1759. Note that <code class="code">rt_flush_period</code> only controls the
  1760. frequency at which the <span class="emphasis"><em>checks</em></span> happen.
  1761. There are no <span class="emphasis"><em>guarantees</em></span> that the
  1762. particular RAM chunk will get saved. For instance, it does
  1763. not make sense to regularly re-save a huge RAM chunk that
  1764. only gets a few rows worth of updates. The search daemon
  1765. determine whether to actually perform the flush with a few
  1766. heuristics.
  1767. </p></div></div>
  1768. <div class="chapter" title="Chapter&nbsp;5.&nbsp;Searching"><div class="titlepage"><div><div><h2 class="title"><a name="searching"></a>Chapter&nbsp;5.&nbsp;Searching</h2></div></div></div>
  1769. <div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#matching-modes">5.1. Matching modes</a></span></dt>
  1770. <dt><span class="sect1"><a href="#boolean-syntax">5.2. Boolean query syntax</a></span></dt>
  1771. <dt><span class="sect1"><a href="#extended-syntax">5.3. Extended query syntax</a></span></dt>
  1772. <dt><span class="sect1"><a href="#weighting">5.4. Search results ranking</a></span></dt>
  1773. <dd><dl><dt><span class="sect2"><a href="#ranking-overview">5.4.1. Ranking overview</a></span></dt>
  1774. <dt><span class="sect2"><a href="#builtin-rankers">5.4.2. Available built-in rankers</a></span></dt>
  1775. <dt><span class="sect2"><a href="#expression-ranker">5.4.3. Expression based ranker (SPH_RANK_EXPR)</a></span></dt>
  1776. <dt><span class="sect2"><a href="#ranking-factors">5.4.4. Quick summary of the ranking factors</a></span></dt>
  1777. <dt><span class="sect2"><a href="#document-factors">5.4.5. Document-level ranking factors</a></span></dt>
  1778. <dt><span class="sect2"><a href="#field-factors">5.4.6. Field-level ranking factors</a></span></dt>
  1779. <dt><span class="sect2"><a href="#factor-aggr-functions">5.4.7. Ranking factor aggregation functions</a></span></dt>
  1780. <dt><span class="sect2"><a href="#formulas-for-builtin-rankers">5.4.8. Formula expressions for all the built-in rankers</a></span></dt>
  1781. </dl></dd><dt><span class="sect1"><a href="#expressions">5.5. Expressions, functions, and operators</a></span></dt>
  1782. <dd><dl><dt><span class="sect2"><a href="#operators">5.5.1. Operators</a></span></dt>
  1783. <dt><span class="sect2"><a href="#numeric-functions">5.5.2. Numeric functions</a></span></dt>
  1784. <dt><span class="sect2"><a href="#date-time-functions">5.5.3. Date and time functions</a></span></dt>
  1785. <dt><span class="sect2"><a href="#type-conversion-functions">5.5.4. Type conversion functions</a></span></dt>
  1786. <dt><span class="sect2"><a href="#comparison-functions">5.5.5. Comparison functions</a></span></dt>
  1787. <dt><span class="sect2"><a href="#misc-functions">5.5.6. Miscellaneous functions</a></span></dt>
  1788. </dl></dd><dt><span class="sect1"><a href="#sorting-modes">5.6. Sorting modes</a></span></dt>
  1789. <dt><span class="sect1"><a href="#clustering">5.7. Grouping (clustering) search results </a></span></dt>
  1790. <dt><span class="sect1"><a href="#distributed">5.8. Distributed searching</a></span></dt>
  1791. <dt><span class="sect1"><a href="#query-log-format">5.9. <code class="filename">searchd</code> query log formats</a></span></dt>
  1792. <dd><dl><dt><span class="sect2"><a href="#plain-log-format">5.9.1. Plain log format</a></span></dt>
  1793. <dt><span class="sect2"><a href="#sphinxql-log-format">5.9.2. SphinxQL log format</a></span></dt>
  1794. </dl></dd><dt><span class="sect1"><a href="#sphinxql">5.10. MySQL protocol support and SphinxQL</a></span></dt>
  1795. <dt><span class="sect1"><a href="#multi-queries">5.11. Multi-queries</a></span></dt>
  1796. <dt><span class="sect1"><a href="#collations">5.12. Collations</a></span></dt>
  1797. </dl></div>
  1798. <div class="sect1" title="5.1.&nbsp;Matching modes"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="matching-modes"></a>5.1.&nbsp;Matching modes</h2></div></div></div>
  1799. <p>
  1800. So-called matching modes are a legacy feature that used to provide
  1801. (very) limited query syntax and ranking support. Currently, they are
  1802. deprecated in favor of <a class="link" href="#extended-syntax" title="5.3.&nbsp;Extended query syntax">full-text query
  1803. language</a> and so-called <a class="link" href="#weighting" title="5.4.&nbsp;Search results ranking">rankers</a>.
  1804. Starting with version 0.9.9-release, it is thus strongly recommended
  1805. to use SPH_MATCH_EXTENDED and proper query syntax rather than any other
  1806. legacy mode. All those other modes are actually internally converted
  1807. to extended syntax anyway. SphinxAPI still defaults to SPH_MATCH_ALL
  1808. but that is for compatibility reasons only.
  1809. </p><p>
  1810. There are the following matching modes available:
  1811. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>SPH_MATCH_ALL, matches all query words;</p></li>
  1812. <li class="listitem"><p>SPH_MATCH_ANY, matches any of the query words;</p></li>
  1813. <li class="listitem"><p>SPH_MATCH_PHRASE, matches query as a phrase, requiring perfect match;</p></li>
  1814. <li class="listitem"><p>SPH_MATCH_BOOLEAN, matches query as a boolean expression (see <a class="xref" href="#boolean-syntax" title="5.2.&nbsp;Boolean query syntax">Section&nbsp;5.2, &#8220;Boolean query syntax&#8221;</a>);</p></li>
  1815. <li class="listitem"><p>SPH_MATCH_EXTENDED, matches query as an expression in Sphinx internal query language
  1816. (see <a class="xref" href="#extended-syntax" title="5.3.&nbsp;Extended query syntax">Section&nbsp;5.3, &#8220;Extended query syntax&#8221;</a>);</p></li>
  1817. <li class="listitem"><p>SPH_MATCH_EXTENDED2, an alias for SPH_MATCH_EXTENDED (default mode);</p></li>
  1818. <li class="listitem"><p>SPH_MATCH_FULLSCAN, matches query, forcibly using the "full scan" mode as below.
  1819. NB, any query terms will be ignored, such that filters, filter-ranges and grouping
  1820. will still be applied, but no text-matching.</p></li>
  1821. </ul></div>
  1822. <p>
  1823. </p><p>
  1824. SPH_MATCH_EXTENDED2 was used during 0.9.8 and 0.9.9 development cycle,
  1825. when the internal matching engine was being rewritten (for the sake of
  1826. additional functionality and better performance). By 0.9.9-release,
  1827. the older version was removed, and SPH_MATCH_EXTENDED and SPH_MATCH_EXTENDED2
  1828. are now just aliases.
  1829. </p><p>
  1830. The SPH_MATCH_FULLSCAN mode will be automatically activated in place of the specified matching mode when the following conditions are met:
  1831. </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>The query string is empty (ie. its length is zero).</p></li>
  1832. <li class="listitem"><p><a class="link" href="#conf-docinfo" title="12.2.4.&nbsp;docinfo">docinfo</a> storage is set to <code class="code">extern</code>.</p></li>
  1833. </ol></div>
  1834. <p>
  1835. In full scan mode, all the indexed documents will be considered as matching.
  1836. Such queries will still apply filters, sorting, and group by, but will not perform any full-text searching.
  1837. This can be useful to unify full-text and non-full-text searching code, or to offload SQL server
  1838. (there are cases when Sphinx scans will perform better than analogous MySQL queries).
  1839. An example of using the full scan mode might be to find posts in a forum.
  1840. By selecting the forum's user ID via <code class="code">SetFilter()</code> but not actually providing any search text,
  1841. Sphinx will match every document (i.e. every post) where <code class="code">SetFilter()</code> would match -
  1842. in this case providing every post from that user. By default this will be ordered by relevancy,
  1843. followed by Sphinx document ID in ascending order (earliest first).
  1844. </p></div>
  1845. <div class="sect1" title="5.2.&nbsp;Boolean query syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boolean-syntax"></a>5.2.&nbsp;Boolean query syntax</h2></div></div></div>
  1846. <p>
  1847. Boolean queries allow the following special operators to be used:
  1848. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>explicit operator AND: </p><pre class="programlisting">hello &amp; world</pre></li>
  1849. <li class="listitem"><p>operator OR: </p><pre class="programlisting">hello | world</pre></li>
  1850. <li class="listitem"><p>operator NOT:
  1851. </p><pre class="programlisting">
  1852. hello -world
  1853. hello !world
  1854. </pre><p>
  1855. </p></li>
  1856. <li class="listitem"><p>grouping: </p><pre class="programlisting">( hello world )</pre></li>
  1857. </ul></div>
  1858. <p>
  1859. Here's an example query which uses all these operators:
  1860. </p><div class="example"><a name="ex-boolean-query"></a><p class="title"><b>Example&nbsp;5.1.&nbsp;Boolean query example</b></p><div class="example-contents"><pre class="programlisting">
  1861. ( cat -dog ) | ( cat -mouse)
  1862. </pre></div></div>
  1863. <p><br class="example-break">
  1864. </p><p>
  1865. There always is implicit AND operator, so "hello world" query actually
  1866. means "hello &amp; world".
  1867. </p><p>
  1868. OR operator precedence is higher than AND, so "looking for cat | dog | mouse"
  1869. means "looking for ( cat | dog | mouse )" and <span class="emphasis"><em>not</em></span>
  1870. "(looking for cat) | dog | mouse".
  1871. </p><p>
  1872. Since version 2.1.1-beta, queries may be automatically optimized if OPTION boolean_simplify=1 is specified.
  1873. Some transformations performed by this optimization include:
  1874. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Excess brackets: ((A | B) | C) becomes ( A | B | C ); ((A B) C) becomes ( A B C )</p></li>
  1875. <li class="listitem"><p>Excess AND NOT: ((A !N1) !N2) becomes (A !(N1 | N2))</p></li>
  1876. <li class="listitem"><p>Common NOT: ((A !N) | (B !N)) becomes ((A|B) !N)</p></li>
  1877. <li class="listitem"><p>Common Compound NOT: ((A !(N AA)) | (B !(N BB))) becomes (((A|B) !N) | (A !AA) | (B !BB)) if the cost of evaluating N is greater than the added together costs of evaluating A and B</p></li>
  1878. <li class="listitem"><p>Common subterm: ((A (N | AA)) | (B (N | BB))) becomes (((A|B) N) | (A AA) | (B BB)) if the cost of evaluating N is greater than the added together costs of evaluating A and B</p></li>
  1879. <li class="listitem"><p>Common keywords: (A | "A B"~N) becomes A; ("A B" | "A B C") becomes "A B"; ("A B"~N | "A B C"~N) becomes ("A B"~N)</p></li>
  1880. <li class="listitem"><p>Common phrase: ("X A B" | "Y A B") becomes (("X|Y") "A B")</p></li>
  1881. <li class="listitem"><p>Common AND NOT: ((A !X) | (A !Y) | (A !Z)) becomes (A !(X Y Z))</p></li>
  1882. <li class="listitem"><p>Common OR NOT: ((A !(N | N1)) | (B !(N | N2))) becomes (( (A !N1) | (B !N2) ) !N)</p></li>
  1883. </ul></div>
  1884. <p>
  1885. Note that optimizing the queries consumes CPU time, so for simple queries -or for hand-optimized queries- you'll do
  1886. better with the default boolean_simplify=0 value. Simplifications are often better for complex queries, or
  1887. algorithmically generated queries.
  1888. </p><p>
  1889. Queries like "-dog", which implicitly include all documents from the
  1890. collection, can not be evaluated. This is both for technical and performance
  1891. reasons. Technically, Sphinx does not always keep a list of all IDs.
  1892. Performance-wise, when the collection is huge (ie. 10-100M documents),
  1893. evaluating such queries could take very long.
  1894. </p></div>
  1895. <div class="sect1" title="5.3.&nbsp;Extended query syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="extended-syntax"></a>5.3.&nbsp;Extended query syntax</h2></div></div></div>
  1896. <p>
  1897. The following special operators and modifiers can be used when using the extended matching mode:
  1898. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>operator OR: </p><pre class="programlisting">hello | world</pre></li>
  1899. <li class="listitem"><p>operator MAYBE (introduced in verion 2.2.3-beta): </p><pre class="programlisting">hello MAYBE world</pre></li>
  1900. <li class="listitem"><p>operator NOT:
  1901. </p><pre class="programlisting">
  1902. hello -world
  1903. hello !world
  1904. </pre><p>
  1905. </p></li>
  1906. <li class="listitem"><p>field search operator: </p><pre class="programlisting">@title hello @body world</pre></li>
  1907. <li class="listitem"><p>field position limit modifier (introduced in version 0.9.9-rc1): </p><pre class="programlisting">@body[50] hello</pre></li>
  1908. <li class="listitem"><p>multiple-field search operator: </p><pre class="programlisting">@(title,body) hello world</pre></li>
  1909. <li class="listitem"><p>ignore field search operator (will ignore any matches of 'hello world' from field 'title'): </p><pre class="programlisting">@!title hello world</pre></li>
  1910. <li class="listitem"><p>ignore multiple-field search operator (if we have fields title, subject and body then @!(title) is equivalent to @(subject,body)): </p><pre class="programlisting">@!(title,body) hello world</pre></li>
  1911. <li class="listitem"><p>all-field search operator: </p><pre class="programlisting">@* hello</pre></li>
  1912. <li class="listitem"><p>phrase search operator: </p><pre class="programlisting">"hello world"</pre></li>
  1913. <li class="listitem"><p>proximity search operator: </p><pre class="programlisting">"hello world"~10</pre></li>
  1914. <li class="listitem"><p>quorum matching operator: </p><pre class="programlisting">"the world is a wonderful place"/3</pre></li>
  1915. <li class="listitem"><p>strict order operator (aka operator "before"): </p><pre class="programlisting">aaa &lt;&lt; bbb &lt;&lt; ccc</pre></li>
  1916. <li class="listitem"><p>exact form modifier (introduced in version 0.9.9-rc1): </p><pre class="programlisting">raining =cats and =dogs</pre></li>
  1917. <li class="listitem"><p>field-start and field-end modifier (introduced in version 0.9.9-rc2): </p><pre class="programlisting">^hello world$</pre></li>
  1918. <li class="listitem"><p>keyword IDF boost modifier (introduced in version 2.2.3-beta): </p><pre class="programlisting">boosted^1.234 boostedfieldend$^1.234</pre></li>
  1919. <li class="listitem"><p>NEAR, generalized proximity operator (introduced in version 2.0.1-beta): </p><pre class="programlisting">hello NEAR/3 world NEAR/4 "my test"</pre></li>
  1920. <li class="listitem"><p>SENTENCE operator (introduced in version 2.0.1-beta): </p><pre class="programlisting">all SENTENCE words SENTENCE "in one sentence"</pre></li>
  1921. <li class="listitem"><p>PARAGRAPH operator (introduced in version 2.0.1-beta): </p><pre class="programlisting">"Bill Gates" PARAGRAPH "Steve Jobs"</pre></li>
  1922. <li class="listitem"><p>ZONE limit operator: </p><pre class="programlisting">ZONE:(h3,h4)</pre><p> only in these titles</p></li>
  1923. <li class="listitem"><p>ZONESPAN limit operator: </p><pre class="programlisting">ZONESPAN:(h2)</pre><p> only in a (single) title</p></li>
  1924. </ul></div>
  1925. <p>
  1926. Here's an example query that uses some of these operators:
  1927. </p><div class="example"><a name="ex-extended-query"></a><p class="title"><b>Example&nbsp;5.2.&nbsp;Extended matching mode: query example</b></p><div class="example-contents"><pre class="programlisting">
  1928. "hello world" @title "example program"~5 @body python -(php|perl) @* code
  1929. </pre></div></div>
  1930. <p><br class="example-break">
  1931. The full meaning of this search is:
  1932. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Find the words 'hello' and 'world' adjacently in any field in a document;</p></li>
  1933. <li class="listitem"><p>Additionally, the same document must also contain the words 'example' and 'program'
  1934. in the title field, with up to, but not including, 5 words between the words in question;
  1935. (E.g. "example PHP program" would be matched however "example script to introduce outside data
  1936. into the correct context for your program" would not because two terms have 5 or more words between them)</p></li>
  1937. <li class="listitem"><p>Additionally, the same document must contain the word 'python' in the body field, but not contain either 'php' or 'perl';</p></li>
  1938. <li class="listitem"><p>Additionally, the same document must contain the word 'code' in any field.</p></li>
  1939. </ul></div>
  1940. <p>
  1941. </p><p>
  1942. There always is implicit AND operator, so "hello world" means that
  1943. both "hello" and "world" must be present in matching document.
  1944. </p><p>
  1945. OR operator precedence is higher than AND, so "looking for cat | dog | mouse"
  1946. means "looking for ( cat | dog | mouse )" and <span class="emphasis"><em>not</em></span>
  1947. "(looking for cat) | dog | mouse".
  1948. </p><p>
  1949. Field limit operator limits subsequent searching to a given field.
  1950. Normally, query will fail with an error message if given field name does not exist
  1951. in the searched index. However, that can be suppressed by specifying "@@relaxed"
  1952. option at the very beginning of the query:
  1953. </p><pre class="programlisting">
  1954. @@relaxed @nosuchfield my query
  1955. </pre><p>
  1956. This can be helpful when searching through heterogeneous indexes with
  1957. different schemas.
  1958. </p><p>
  1959. Field position limit, introduced in version 0.9.9-rc1, additionally restricts the searching
  1960. to first N position within given field (or fields). For example, "@body[50] hello" will
  1961. <span class="bold"><strong>not</strong></span> match the documents where the keyword 'hello' occurs at position 51 and below
  1962. in the body.
  1963. </p><p>
  1964. Proximity distance is specified in words, adjusted for word count, and
  1965. applies to all words within quotes. For instance, "cat dog mouse"~5 query
  1966. means that there must be less than 8-word span which contains all 3 words,
  1967. ie. "CAT aaa bbb ccc DOG eee fff MOUSE" document will <span class="emphasis"><em>not</em></span>
  1968. match this query, because this span is exactly 8 words long.
  1969. </p><p>
  1970. Quorum matching operator introduces a kind of fuzzy matching.
  1971. It will only match those documents that pass a given threshold of given words.
  1972. The example above ("the world is a wonderful place"/3) will match all documents
  1973. that have at least 3 of the 6 specified words. Operator is limited to 255 keywords.
  1974. Instead of an absolute number, you can also specify a number between 0.0 and 1.0
  1975. (standing for 0% and 100%), and Sphinx will match only documents with at least
  1976. the specified percentage of given words. The same example above could also have
  1977. been written "the world is a wonderful place"/0.5 and it would match documents
  1978. with at least 50% of the 6 words.
  1979. </p><p>
  1980. Strict order operator (aka operator "before"), introduced in version 0.9.9-rc2,
  1981. will match the document only if its argument keywords occur in the document
  1982. exactly in the query order. For instance, "black &lt;&lt; cat" query (without
  1983. quotes) will match the document "black and white cat" but <span class="emphasis"><em>not</em></span>
  1984. the "that cat was black" document. Order operator has the lowest priority.
  1985. It can be applied both to just keywords and more complex expressions,
  1986. ie. this is a valid query:
  1987. </p><pre class="programlisting">
  1988. (bag of words) &lt;&lt; "exact phrase" &lt;&lt; red|green|blue
  1989. </pre><p>
  1990. </p><p>
  1991. Exact form keyword modifier, introduced in version 0.9.9-rc1, will match the document only if the keyword occurred
  1992. in exactly the specified form. The default behavior is to match the document
  1993. if the stemmed keyword matches. For instance, "runs" query will match both
  1994. the document that contains "runs" <span class="emphasis"><em>and</em></span> the document that
  1995. contains "running", because both forms stem to just "run" - while "=runs"
  1996. query will only match the first document. Exact form operator requires
  1997. <a class="link" href="#conf-index-exact-words" title="12.2.42.&nbsp;index_exact_words">index_exact_words</a> option to be enabled.
  1998. This is a modifier that affects the keyword and thus can be used within
  1999. operators such as phrase, proximity, and quorum operators.
  2000. Starting with 2.2.2-beta, it is possible to apply an exact form modifier
  2001. to the phrase operator. It's really just syntax sugar - it adds an exact form
  2002. modifier to all terms contained within the phrase.
  2003. </p><pre class="programlisting">
  2004. ="exact phrase"
  2005. </pre><p>
  2006. </p><p>
  2007. Field-start and field-end keyword modifiers, introduced in version 0.9.9-rc2,
  2008. will make the keyword match only if it occurred at the very start or the very end
  2009. of a fulltext field, respectively. For instance, the query "^hello world$"
  2010. (with quotes and thus combining phrase operator and start/end modifiers)
  2011. will only match documents that contain at least one field that has exactly
  2012. these two keywords.
  2013. </p><p>
  2014. Starting with 0.9.9-rc1, arbitrarily nested brackets and negations are allowed.
  2015. However, the query must be possible to compute without involving an implicit
  2016. list of all documents:
  2017. </p><pre class="programlisting">
  2018. // correct query
  2019. aaa -(bbb -(ccc ddd))
  2020. // queries that are non-computable
  2021. -aaa
  2022. aaa | -bbb
  2023. </pre><p>
  2024. </p><p>
  2025. Starting with 2.2.2-beta, the phrase search operator may include a 'match any term'
  2026. modifier. Terms within the phrase operator are position significant. When
  2027. the 'match any term' modifier is implemented, the position of the subsequent terms
  2028. from that phrase query will be shifted. Therefore, 'match any' has no impact
  2029. on search performance.
  2030. </p><pre class="programlisting">
  2031. "exact * phrase * * for terms"
  2032. </pre><p>
  2033. </p><p>
  2034. <span class="bold"><strong>NEAR operator</strong></span>, added in 2.0.1-beta, is a generalized version
  2035. of a proximity operator. The syntax is <code class="code">NEAR/N</code>, it is
  2036. case-sensitive, and no spaces are allowed between the NEAR keyword,
  2037. the slash sign, and the distance value.
  2038. </p><p>
  2039. The original proximity operator only worked on sets of keywords.
  2040. NEAR is more generic and can accept arbitrary subexpressions as
  2041. its two arguments, matching the document when both subexpressions
  2042. are found within N words of each other, no matter in which order.
  2043. NEAR is left associative and has the same (lowest) precedence
  2044. as BEFORE.
  2045. </p><p>
  2046. You should also note how a <code class="code">(one NEAR/7 two NEAR/7 three)</code>
  2047. query using NEAR is not really equivalent to a
  2048. <code class="code">("one two three"~7)</code> one using keyword proximity operator.
  2049. The difference here is that the proximity operator allows for up to
  2050. 6 non-matching words between all the 3 matching words, but the version
  2051. with NEAR is less restrictive: it would allow for up to 6 words between
  2052. 'one' and 'two' and then for up to 6 more between that two-word
  2053. matching and a 'three' keyword.
  2054. </p><p>
  2055. <span class="bold"><strong>SENTENCE and PARAGRAPH operators</strong></span>, added in 2.0.1-beta,
  2056. matches the document when both its arguments are within the same
  2057. sentence or the same paragraph of text, respectively. The arguments
  2058. can be either keywords, or phrases, or the instances of the same
  2059. operator. Here are a few examples:
  2060. </p><pre class="programlisting">
  2061. one SENTENCE two
  2062. one SENTENCE "two three"
  2063. one SENTENCE "two three" SENTENCE four
  2064. </pre><p>
  2065. The order of the arguments within the sentence or paragraph
  2066. does not matter. These operators only work on indexes built
  2067. with <a class="link" href="#conf-index-sp" title="12.2.8.&nbsp;index_sp">index_sp</a> (sentence
  2068. and paragraph indexing feature) enabled, and revert to a mere
  2069. AND otherwise. Refer to the <code class="code">index_sp</code> directive
  2070. documentation for the notes on what's considered a sentence
  2071. and a paragraph.
  2072. </p><p>
  2073. <span class="bold"><strong>ZONE limit operator</strong></span>, added in 2.0.1-beta, is quite similar
  2074. to field limit operator, but restricts matching to a given in-field
  2075. zone or a list of zones. Note that the subsequent subexpressions
  2076. are <span class="emphasis"><em>not</em></span> required to match in a single contiguous
  2077. span of a given zone, and may match in multiple spans.
  2078. For instance, <code class="code">(ZONE:th hello world)</code> query
  2079. <span class="emphasis"><em>will</em></span> match this example document:
  2080. </p><pre class="programlisting">
  2081. &lt;th&gt;Table 1. Local awareness of Hello Kitty brand.&lt;/th&gt;
  2082. .. some table data goes here ..
  2083. &lt;th&gt;Table 2. World-wide brand awareness.&lt;/th&gt;
  2084. </pre><p>
  2085. ZONE operator affects the query until the next
  2086. field or ZONE limit operator, or the closing parenthesis.
  2087. It only works on the indexes built with zones support
  2088. (see <a class="xref" href="#conf-index-zones" title="12.2.9.&nbsp;index_zones">Section&nbsp;12.2.9, &#8220;index_zones&#8221;</a>) and will be ignored
  2089. otherwise.
  2090. </p><p>
  2091. <span class="bold"><strong>ZONESPAN limit operator</strong></span>, added in 2.1.1-beta, is similar to the ZONE operator,
  2092. but requires the match to occur in a single contiguous span. In the example
  2093. above, <code class="code">(ZONESPAN:th hello world)&gt;</code> would not match the document,
  2094. since "hello" and "world" do not occur within the same span.
  2095. </p><p>
  2096. <span class="bold"><strong>MAYBE</strong></span> operator was added in 2.2.3-beta. It works much like |
  2097. operator but doesn't return documents which match only right subtree expression.
  2098. </p></div>
  2099. <div class="sect1" title="5.4.&nbsp;Search results ranking"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="weighting"></a>5.4.&nbsp;Search results ranking</h2></div></div></div>
  2100. <div class="sect2" title="5.4.1.&nbsp;Ranking overview"><div class="titlepage"><div><div><h3 class="title"><a name="ranking-overview"></a>5.4.1.&nbsp;Ranking overview</h3></div></div></div>
  2101. <p>
  2102. Ranking (aka weighting) of the search results can be defined
  2103. as a process of computing a so-called relevance (aka weight)
  2104. for every given matched document with regards to a given query
  2105. that matched it. So relevance is in the end just a number attached
  2106. to every document that estimates how relevant the document is to
  2107. the query. Search results can then be sorted based on this number
  2108. and/or some additional parameters, so that the most sought after
  2109. results would come up higher on the results page.
  2110. </p><p>
  2111. There is no single standard one-size-fits-all way to rank
  2112. any document in any scenario. Moreover, there can not ever be
  2113. such a way, because relevance is <span class="emphasis"><em>subjective</em></span>.
  2114. As in, what seems relevant to you might not seem relevant to me.
  2115. Hence, in general case it's not just hard to compute, it's
  2116. theoretically impossible.
  2117. </p><p>
  2118. So ranking in Sphinx is configurable. It has a notion of
  2119. a so-called <span class="bold"><strong>ranker</strong></span>. A ranker can formally be defined
  2120. as a function that takes document and query as its input and
  2121. produces a relevance value as output. In layman's terms,
  2122. a ranker controls exactly how (using which specific algorithm)
  2123. will Sphinx assign weights to the document.
  2124. </p><p>
  2125. Previously, this ranking function was rigidly bound to the matching mode.
  2126. So in the legacy matching modes (that is, SPH_MATCH_ALL, SPH_MATCH_ANY,
  2127. SPH_MATCH_PHRASE, and SPH_MATCH_BOOLEAN) you can not choose the ranker.
  2128. You can only do that in the SPH_MATCH_EXTENDED mode. (Which is the only
  2129. mode in SphinxQL and the suggested mode in SphinxAPI anyway.) To choose
  2130. a non-default ranker you can either use
  2131. <a class="link" href="#api-func-setrankingmode" title="9.3.2.&nbsp;SetRankingMode">SetRankingMode()</a>
  2132. with SphinxAPI, or <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">OPTION ranker</a>
  2133. clause in <code class="code">SELECT</code> statement when using SphinxQL.
  2134. </p><p>
  2135. As a sidenote, legacy matching modes are internally implemented via
  2136. the unified syntax anyway. When you use one of those modes, Sphinx just
  2137. internally adjusts the query and sets the associated ranker, then
  2138. executes the query using the very same unified code path.
  2139. </p></div>
  2140. <div class="sect2" title="5.4.2.&nbsp;Available built-in rankers"><div class="titlepage"><div><div><h3 class="title"><a name="builtin-rankers"></a>5.4.2.&nbsp;Available built-in rankers</h3></div></div></div>
  2141. <p>
  2142. Sphinx ships with a number of built-in rankers suited for different
  2143. purposes. A number of them uses two factors, phrase proximity (aka LCS)
  2144. and BM25. Phrase proximity works on the keyword positions, while BM25
  2145. works on the keyword frequencies. Basically, the better the degree of
  2146. the phrase match between the document body and the query, the higher
  2147. is the phrase proximity (it maxes out when the document contains
  2148. the entire query as a verbatim quote). And BM25 is higher when
  2149. the document contains more rare words. We'll save the detailed
  2150. discussion for later.
  2151. </p><p>
  2152. Currently implemented rankers are:
  2153. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
  2154. SPH_RANK_PROXIMITY_BM25, the default ranking mode that uses and combines
  2155. both phrase proximity and BM25 ranking.
  2156. </p></li>
  2157. <li class="listitem"><p>
  2158. SPH_RANK_BM25, statistical ranking mode which uses BM25 ranking only (similar to
  2159. most other full-text engines). This mode is faster but may result in worse quality
  2160. on queries which contain more than 1 keyword.
  2161. </p></li>
  2162. <li class="listitem"><p>
  2163. SPH_RANK_NONE, no ranking mode. This mode is obviously the fastest.
  2164. A weight of 1 is assigned to all matches. This is sometimes called boolean
  2165. searching that just matches the documents but does not rank them.
  2166. </p></li>
  2167. <li class="listitem"><p>SPH_RANK_WORDCOUNT, ranking by the keyword occurrences count.
  2168. This ranker computes the per-field keyword occurrence counts, then multiplies
  2169. them by field weights, and sums the resulting values.
  2170. </p></li>
  2171. <li class="listitem"><p>
  2172. SPH_RANK_PROXIMITY, added in version 0.9.9-rc1, returns raw phrase proximity
  2173. value as a result. This mode is internally used to emulate SPH_MATCH_ALL queries.
  2174. </p></li>
  2175. <li class="listitem"><p>
  2176. SPH_RANK_MATCHANY, added in version 0.9.9-rc1, returns rank as it was computed
  2177. in SPH_MATCH_ANY mode earlier, and is internally used to emulate SPH_MATCH_ANY queries.
  2178. </p></li>
  2179. <li class="listitem"><p>
  2180. SPH_RANK_FIELDMASK, added in version 0.9.9-rc2, returns a 32-bit mask with
  2181. N-th bit corresponding to N-th fulltext field, numbering from 0. The bit will
  2182. only be set when the respective field has any keyword occurrences satisfying
  2183. the query.
  2184. </p></li>
  2185. <li class="listitem"><p>
  2186. SPH_RANK_SPH04, added in version 1.10-beta, is generally based on the default
  2187. SPH_RANK_PROXIMITY_BM25 ranker, but additionally boosts the matches when
  2188. they occur in the very beginning or the very end of a text field. Thus,
  2189. if a field equals the exact query, SPH04 should rank it higher than a field
  2190. that contains the exact query but is not equal to it. (For instance, when
  2191. the query is "Hyde Park", a document entitled "Hyde Park" should be ranked
  2192. higher than a one entitled "Hyde Park, London" or "The Hyde Park Cafe".)
  2193. </p></li>
  2194. <li class="listitem"><p>
  2195. SPH_RANK_EXPR, added in version 2.0.2-beta, lets you specify the ranking
  2196. formula in run time. It exposes a number of internal text factors and lets
  2197. you define how the final weight should be computed from those factors.
  2198. You can find more details about its syntax and a reference available
  2199. factors in a subsection below.
  2200. </p></li>
  2201. </ul></div>
  2202. <p>
  2203. </p><p>
  2204. You should specify the <code class="code">SPH_RANK_</code> prefix and use capital letters only
  2205. when using the <a class="link" href="#api-func-setrankingmode" title="9.3.2.&nbsp;SetRankingMode">SetRankingMode()</a>
  2206. call from the SphinxAPI. The API ports expose these as global constants.
  2207. Using SphinxQL syntax, the prefix should be omitted and the ranker name
  2208. is case insensitive. Example:
  2209. </p><pre class="programlisting">
  2210. // SphinxAPI
  2211. $client-&gt;SetRankingMode ( SPH_RANK_SPH04 );
  2212. // SphinxQL
  2213. mysql_query ( "SELECT ... OPTION ranker=sph04" );
  2214. </pre><p>
  2215. </p><h4><a name="idp31462512"></a>Legacy matching modes rankers</h4><p>
  2216. Legacy matching modes automatically select a ranker as follows:
  2217. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>SPH_MATCH_ALL uses SPH_RANK_PROXIMITY ranker;</p></li>
  2218. <li class="listitem"><p>SPH_MATCH_ANY uses SPH_RANK_MATCHANY ranker;</p></li>
  2219. <li class="listitem"><p>SPH_MATCH_PHRASE uses SPH_RANK_PROXIMITY ranker;</p></li>
  2220. <li class="listitem"><p>SPH_MATCH_BOOLEAN uses SPH_RANK_NONE ranker.</p></li>
  2221. </ul></div>
  2222. <p>
  2223. </p></div>
  2224. <div class="sect2" title="5.4.3.&nbsp;Expression based ranker (SPH_RANK_EXPR)"><div class="titlepage"><div><div><h3 class="title"><a name="expression-ranker"></a>5.4.3.&nbsp;Expression based ranker (SPH_RANK_EXPR)</h3></div></div></div>
  2225. <p>
  2226. Expression ranker, added in version 2.0.2-beta, lets you change the ranking
  2227. formula on the fly, on a per-query basis. For a quick kickoff, this is how you
  2228. emulate PROXIMITY_BM25 ranker using the expression based one:
  2229. </p><pre class="programlisting">
  2230. SELECT *, WEIGHT() FROM myindex WHERE MATCH('hello world')
  2231. OPTION ranker=expr('sum(lcs*user_weight)*1000+bm25')
  2232. </pre><p>
  2233. The output of this query must not change if you omit the <code class="code">OPTION</code>
  2234. clause, because the default ranker (PROXIMITY_BM25) behaves exactly like
  2235. specified in the ranker formula above. But the expression ranker is somewhat
  2236. more flexible than just that and provides access to many more factors.
  2237. </p><p>
  2238. The ranking formula is an arbitrary arithmetic expression that can use
  2239. constants, document attributes, built-in functions and operators (described
  2240. in <a class="xref" href="#expressions" title="5.5.&nbsp;Expressions, functions, and operators">Section&nbsp;5.5, &#8220;Expressions, functions, and operators&#8221;</a>), and also a few ranking-specific things
  2241. that are only accessible in a ranking formula. Namely, those are field
  2242. aggregation functions, field-level, and document-level ranking factors.
  2243. </p></div>
  2244. <div class="sect2" title="5.4.4.&nbsp;Quick summary of the ranking factors"><div class="titlepage"><div><div><h3 class="title"><a name="ranking-factors"></a>5.4.4.&nbsp;Quick summary of the ranking factors</h3></div></div></div>
  2245. <p>
  2246. </p><div class="table"><a name="ranking-factors-table"></a><p class="title"><b>Table&nbsp;5.1.&nbsp;</b></p><div class="table-contents"><table border="1"><colgroup><col class="name"><col class="level"><col class="type"></colgroup><thead><tr><th>Name</th><th>Level</th><th>Type</th><th>Summary</th></tr></thead><tbody><tr><td>max_lcs</td><td>query</td><td>int</td><td>maximum possible LCS value for the current query</td></tr><tr><td>bm25</td><td>document</td><td>int</td><td>quick estimate of BM25(1.2, 0) without syntax support</td></tr><tr><td>bm25a(k1, b)</td><td>document</td><td>int</td><td>precise BM25() value with configurable K1, B constants and syntax support</td></tr><tr><td>bm25f(k1, b, {field=weight, ...})</td><td>document</td><td>int</td><td>precise BM25F() value with extra configurable field weights</td></tr><tr><td>field_mask</td><td>document</td><td>int</td><td>bit mask of matched fields</td></tr><tr><td>query_word_count</td><td>document</td><td>int</td><td>number of unique inclusive keywords in a query</td></tr><tr><td>doc_word_count</td><td>document</td><td>int</td><td>number of unique keywords matched in the document</td></tr><tr><td>lcs</td><td>field</td><td>int</td><td>Longest Common Subsequence between query and document, in words</td></tr><tr><td>user_weight</td><td>field</td><td>int</td><td>user field weight</td></tr><tr><td>hit_count</td><td>field</td><td>int</td><td>total number of keyword occurrences</td></tr><tr><td>word_count</td><td>field</td><td>int</td><td>number of unique matched keywords</td></tr><tr><td>tf_idf</td><td>field</td><td>float</td><td>sum(tf*idf) over matched keywords == sum(idf) over occurrences</td></tr><tr><td>min_hit_pos</td><td>field</td><td>int</td><td>first matched occurrence position, in words, 1-based</td></tr><tr><td>min_best_span_pos</td><td>field</td><td>int</td><td>first maximum LCS span position, in words, 1-based</td></tr><tr><td>exact_hit</td><td>field</td><td>bool</td><td>whether query == field</td></tr><tr><td>min_idf</td><td>field</td><td>float</td><td>min(idf) over matched keywords</td></tr><tr><td>max_idf</td><td>field</td><td>float</td><td>max(idf) over matched keywords</td></tr><tr><td>sum_idf</td><td>field</td><td>float</td><td>sum(idf) over matched keywords</td></tr><tr><td>exact_order</td><td>field</td><td>bool</td><td>whether all query keywords were a) matched and b) in query order</td></tr><tr><td>min_gaps</td><td>field</td><td>int</td><td>minimum number of gaps between the matched keywords over the matching spans</td></tr><tr><td>lccs</td><td>field</td><td>int</td><td>Longest Common Contiguous Subsequence between query and document, in words</td></tr><tr><td>wlccs</td><td>field</td><td>float</td><td>Weighted Longest Common Contiguous Subsequence, sum(idf) over contiguous keyword spans</td></tr><tr><td>atc</td><td>field</td><td>float</td><td>Aggregate Term Closeness, log(1+sum(idf1*idf2*pow(distance, -1.75)) over the best pairs of keywords</td></tr></tbody></table></div></div>
  2247. <p><br class="table-break">
  2248. </p></div>
  2249. <div class="sect2" title="5.4.5.&nbsp;Document-level ranking factors"><div class="titlepage"><div><div><h3 class="title"><a name="document-factors"></a>5.4.5.&nbsp;Document-level ranking factors</h3></div></div></div>
  2250. <p>
  2251. A <span class="bold"><strong>document-level factor</strong></span> is a numeric value computed by the ranking
  2252. engine for every matched document with regards to the current query.
  2253. (So it differs from a plain document attribute in that the attribute
  2254. do not depend on the full text query, while factors might.) Those
  2255. factors can be used anywhere in the ranking expression.
  2256. Currently implemented document-level factors are:
  2257. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
  2258. <code class="code">bm25</code> (integer), a document-level BM25 estimate (computed without
  2259. keyword occurrence filtering).
  2260. </p></li>
  2261. <li class="listitem"><p>
  2262. <code class="code">max_lcs</code> (integer), a query-level maximum possible value that
  2263. the sum(lcs*user_weight) expression can ever take. This can be
  2264. useful for weight boost scaling. For instance, MATCHANY ranker
  2265. formula uses this to guarantee that a full phrase match in any
  2266. field ranks higher than any combination of partial matches
  2267. in all fields.
  2268. </p></li>
  2269. <li class="listitem"><p>
  2270. <code class="code">field_mask</code> (integer), a document-level 32-bit mask of matched
  2271. fields.
  2272. </p></li>
  2273. <li class="listitem"><p>
  2274. <code class="code">query_word_count</code> (integer), the number of unique keywords
  2275. in a query, adjusted for a number of excluded keywords. For instance,
  2276. both <code class="code">(one one one one)</code> and <code class="code">(one !two)</code> queries
  2277. should assign a value of 1 to this factor, because there is just one unique
  2278. non-excluded keyword.
  2279. </p></li>
  2280. <li class="listitem"><p>
  2281. <code class="code">doc_word_count</code> (integer), the number of unique keywords
  2282. matched in the entire document.
  2283. </p></li>
  2284. </ul></div>
  2285. <p>
  2286. </p></div>
  2287. <div class="sect2" title="5.4.6.&nbsp;Field-level ranking factors"><div class="titlepage"><div><div><h3 class="title"><a name="field-factors"></a>5.4.6.&nbsp;Field-level ranking factors</h3></div></div></div>
  2288. <p>
  2289. A <span class="bold"><strong>field-level factor</strong></span> is a numeric value computed by the ranking
  2290. engine for every matched in-document text field with regards to the
  2291. current query. As more than one field can be matched by a query,
  2292. but the final weight needs to be a single integer value, these
  2293. values need to be folded into a single one. To achieve that,
  2294. field-level factors can only be used within a field aggregation
  2295. function, they can <span class="bold"><strong>not</strong></span> be used anywhere in the expression.
  2296. For example, you can not use <code class="code">(lcs+bm25)</code> as your
  2297. ranking expression, as <code class="code">lcs</code> takes multiple values (one
  2298. in every matched field). You should use <code class="code">(sum(lcs)+bm25)</code>
  2299. instead, that expression sums <code class="code">lcs</code> over all matching fields,
  2300. and then adds <code class="code">bm25</code> to that per-field sum.
  2301. Currently implemented field-level factors are:
  2302. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
  2303. <code class="code">lcs</code> (integer), the length of a maximum verbatim match between
  2304. the document and the query, counted in words. LCS stands for Longest Common
  2305. Subsequence (or Subset). Takes a minimum value of 1 when only stray keywords
  2306. were matched in a field, and a maximum value of query keywords count
  2307. when the entire query was matched in a field verbatim (in the exact
  2308. query keywords order). For example, if the query is 'hello world'
  2309. and the field contains these two words quoted from the query (that is,
  2310. adjacent to each other, and exactly in the query order), <code class="code">lcs</code>
  2311. will be 2. For example, if the query is 'hello world program' and
  2312. the field contains 'hello world', <code class="code">lcs</code> will be 2.
  2313. Note that any subset of the query keyword works, not just a subset
  2314. of adjacent keywords. For example, if the query is 'hello world program'
  2315. and the field contains 'hello (test program)', <code class="code">lcs</code> will be 2
  2316. just as well, because both 'hello' and 'program' matched in the same
  2317. respective positions as they were in the query. Finally, if the query
  2318. is 'hello world program' and the field contains 'hello world program',
  2319. <code class="code">lcs</code> will be 3. (Hopefully that is unsurprising at this point.)
  2320. </p></li>
  2321. <li class="listitem"><p>
  2322. <code class="code">user_weight</code> (integer), the user specified per-field weight
  2323. (refer to <a class="link" href="#api-func-setfieldweights" title="9.3.5.&nbsp;SetFieldWeights">SetFieldWeights()</a>
  2324. in SphinxAPI and <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">OPTION field_weights</a>
  2325. in SphinxQL respectively). The weights default to 1 if not specified
  2326. explicitly.
  2327. </p></li>
  2328. <li class="listitem"><p>
  2329. <code class="code">hit_count</code> (integer), the number of keyword occurrences
  2330. that matched in the field. Note that a single keyword may occur multiple
  2331. times. For example, if 'hello' occurs 3 times in a field and 'world'
  2332. occurs 5 times, <code class="code">hit_count</code> will be 8.
  2333. </p></li>
  2334. <li class="listitem"><p>
  2335. <code class="code">word_count</code> (integer), the number of unique keywords matched
  2336. in the field. For example, if 'hello' and 'world' occur anywhere in a field,
  2337. <code class="code">word_count</code> will be 2, irregardless of how many times do both
  2338. keywords occur.
  2339. </p></li>
  2340. <li class="listitem"><p>
  2341. <code class="code">tf_idf</code> (float), the sum of TF*IDF over all the keywords matched in the
  2342. field. IDF is the Inverse Document Frequency, a floating point value
  2343. between 0 and 1 that describes how frequent is the keywords (basically,
  2344. 0 for a keyword that occurs in every document indexed, and 1 for a unique
  2345. keyword that occurs in just a single document). TF is the Term Frequency,
  2346. the number of matched keyword occurrences in the field. As a side note,
  2347. <code class="code">tf_idf</code> is actually computed by summing IDF over all matched
  2348. occurrences. That's by construction equivalent to summing TF*IDF over
  2349. all matched keywords.
  2350. </p></li>
  2351. <li class="listitem"><p>
  2352. <code class="code">min_hit_pos</code> (integer), the position of the first matched keyword occurrence,
  2353. counted in words. Indexing begins from position 1.
  2354. </p></li>
  2355. <li class="listitem"><p>
  2356. <code class="code">min_best_span_pos</code> (integer), the position of the first maximum LCS
  2357. occurrences span. For example, assume that our query was 'hello world
  2358. program' and 'hello world' subphrase was matched twice in the field,
  2359. in positions 13 and 21. Assume that 'hello' and 'world' additionally
  2360. occurred elsewhere in the field, but never next to each other and thus
  2361. never as a subphrase match. In that case, <code class="code">min_best_span_pos</code>
  2362. will be 13. Note how for the single keyword queries
  2363. <code class="code">min_best_span_pos</code> will always equal <code class="code">min_hit_pos</code>.
  2364. </p></li>
  2365. <li class="listitem"><p>
  2366. <code class="code">exact_hit</code> (boolean), whether a query was an exact match
  2367. of the entire current field. Used in the SPH04 ranker.
  2368. </p></li>
  2369. <li class="listitem"><p>
  2370. <code class="code">min_idf</code>, <code class="code">max_idf</code>, and <code class="code">sum_idf</code> (float),
  2371. added in version 2.1.1-beta. These factors respectively represent the min(idf),
  2372. max(idf) and sum(idf) over all keywords that were matched in the field.
  2373. </p></li>
  2374. <li class="listitem"><p>
  2375. <code class="code">exact_order</code> (boolean), added in version 2.2.1-beta. Whether all of the
  2376. query keywords were matched in the field in the exact query order. For example,
  2377. <code class="code">(microsoft office)</code> query would yield exact_order=1 in a field with the
  2378. following contents: <code class="code">(We use Microsoft software in our office.)</code>.
  2379. However, the very same query in a <code class="code">(Our office is Microsoft free.)</code>
  2380. field would yield exact_order=0.
  2381. </p></li>
  2382. <li class="listitem"><p>
  2383. <code class="code">min_gaps</code> (integer), added in version 2.2.1-beta, the minimum number
  2384. of positional gaps between (just) the keywords matched in field. Always 0 when less
  2385. than 2 keywords match; always greater or equal than 0 otherwise.
  2386. </p><p>
  2387. For example, with a <code class="code">[big wolf]</code> query, <code class="code">[big bad wolf]</code> field
  2388. would yield min_gaps=1; <code class="code">[big bad hairy wolf]</code> field would yield min_gaps=2;
  2389. <code class="code">[the wolf was scary and big]</code> field would yield min_gaps=3; etc.
  2390. However, a field like <code class="code">[i heard a wolf howl]</code> would yield min_gaps=0,
  2391. because only one keyword would be matching in that field, and, naturally, there
  2392. would be no gaps between the <span class="emphasis"><em>matched</em></span>keywords.
  2393. </p><p>
  2394. Therefore, this is a rather low-level, "raw" factor that you would most likely
  2395. want to <span class="emphasis"><em>adjust</em></span> before actually using for ranking. Specific
  2396. adjustments depend heavily on your data and the resulting formula, but here are
  2397. a few ideas you can start with: (a) any min_gaps based boosts could be simply ignored
  2398. when word_count&lt;2; (b) non-trivial min_gaps values (i.e. when word_count&gt;=2)
  2399. could be clamped with a certain "worst case" constant while trivial values
  2400. (i.e. when min_gaps=0 and word_count&lt;2) could be replaced by that constant;
  2401. (c) a transfer function like 1/(1+min_gaps) could be applied (so that better,
  2402. smaller min_gaps values would maximize it and worse, bigger min_gaps values
  2403. would fall off slowly); and so on.
  2404. </p></li>
  2405. <li class="listitem"><p>
  2406. <code class="code">lccs</code> (integer), added in version 2.2.1-beta. Longest Common Contiguous
  2407. Subsequence. A length of the longest subphrase that is common between the query and
  2408. the document, computed in keywords.
  2409. </p><p>
  2410. LCCS factor is rather similar to LCS but more restrictive, in a sense. While LCS could
  2411. be greater than 1 though no two query words are matched next to each other, LCCS
  2412. would only get greater than 1 if there are <span class="emphasis"><em>exact</em></span>, contiguous
  2413. query subphrases in the document. For example, (one two three four five) query
  2414. vs (one hundred three hundred five hundred) document would yield lcs=3, but lccs=1,
  2415. because even though mutual dispositions of 3 keywords (one, three, five) match between
  2416. the query and the document, no 2 matching positions are actually next to each other.
  2417. </p><p>
  2418. Note that LCCS still does not differentiate between the frequent and rare keywords;
  2419. for that, see WLCS and WLLCS.
  2420. </p></li>
  2421. <li class="listitem"><p>
  2422. <code class="code">wlccs</code> (float), added in version 2.2.1-beta. Weighted Longest Common Contiguous
  2423. Subsequence. A sum of IDFs of the keywords of the longest subphrase that is common
  2424. between the query and the document.
  2425. </p><p>
  2426. WLCCS is computed very similarly to LCCS, but every "suitable" keyword occurrence
  2427. increases it by the keyword IDF rather than just by 1 (which is the case with LCS and
  2428. LCCS). That lets us rank sequences of more rare and important keywords higher than
  2429. sequences of frequent keywords, even if the latter are longer. For example, a query
  2430. <code class="code">(Zanzibar bed and breakfast)</code> would yield lccs=1 for a
  2431. <code class="code">(hotels of Zanzibar)</code> document, but lccs=3 against
  2432. <code class="code">(London bed and breakfast)</code>, even though "Zanzibar" is actually
  2433. somewhat more rare than the entire "bed and breakfast" phrase. WLCCS factor alleviates
  2434. that problem by using the keyword frequencies.
  2435. </p></li>
  2436. <li class="listitem"><p>
  2437. <code class="code">atc</code> (float), added in version 2.2.1-beta. Aggregate Term Closeness.
  2438. A proximity based measure that grows higher when the document contains more groups
  2439. of more closely located and more important (rare) query keywords. <span class="bold"><strong>WARNING:</strong></span>
  2440. you should use ATC with OPTION idf='plain,tfidf_unnormalized'; otherwise you would
  2441. get unexpected results.
  2442. </p><p>
  2443. ATC basically works as follows. For every keyword <span class="emphasis"><em>occurrence</em></span>
  2444. in the document, we compute the so called <span class="emphasis"><em>term closeness</em></span>. For that,
  2445. we examine all the other closest occurrences of all the query keywords (keyword itself
  2446. included too) to the left and to the right of the subject occurrence, compute a distance
  2447. dampening coefficient as k = pow(distance, -1.75) for those occurrences, and sum the
  2448. dampened IDFs. Thus for every occurrence of every keyword, we get a "closeness" value
  2449. that describes the "neighbors" of that occurrence. We then multiply those per-occurrence
  2450. closenesses by their respective subject keyword IDF, sum them all, and finally,
  2451. compute a logarithm of that sum.
  2452. </p><p>
  2453. Or in other words, we process the best (closest) matched keyword pairs in the document,
  2454. and compute pairwise "closenesses" as the product of their IDFs scaled by the distance
  2455. coefficient:
  2456. </p><pre class="programlisting">
  2457. pair_tc = idf(pair_word1) * idf(pair_word2) * pow(pair_distance, -1.75)
  2458. </pre><p>
  2459. We then sum such closenesses, and compute the final, log-dampened ATC value:
  2460. </p><pre class="programlisting">
  2461. atc = log(1+sum(pair_tc))
  2462. </pre><p>
  2463. Note that this final dampening logarithm is exactly the reason you should use
  2464. OPTION idf=plain, because without it, the expression inside the log() could be negative.
  2465. </p><p>
  2466. Having closer keyword occurrences actually contributes <span class="emphasis"><em>much</em></span> more
  2467. to ATC than having more frequent keywords. Indeed, when the keywords are right next to
  2468. each other, distance=1 and k=1; when there just one word in between them, distance=2 and
  2469. k=0.297, with two words between, distance=3 and k=0.146, and so on. At the same time
  2470. IDF attenuates somewhat slower. For example, in a 1 million document collection, the IDF
  2471. values for keywords that match in 10, 100, and 1000 documents would be respectively
  2472. 0.833, 0.667, and 0.500. So a keyword pair with two rather rare keywords that occur
  2473. in just 10 documents each but with 2 other words in between would yield pair_tc = 0.101
  2474. and thus just barely outweigh a pair with a 100-doc and a 1000-doc keyword with 1 other
  2475. word between them and pair_tc = 0.099. Moreover, a pair of two <span class="emphasis"><em>unique</em></span>,
  2476. 1-doc keywords with 3 words between them would get a pair_tc = 0.088 and lose to a pair of
  2477. two 1000-doc keywords located right next to each other and yielding a pair_tc = 0.25.
  2478. So, basically, while ATC does combine both keyword frequency and proximity, it is still
  2479. somewhat favoring the proximity.
  2480. </p></li>
  2481. </ul></div>
  2482. <p>
  2483. </p></div>
  2484. <div class="sect2" title="5.4.7.&nbsp;Ranking factor aggregation functions"><div class="titlepage"><div><div><h3 class="title"><a name="factor-aggr-functions"></a>5.4.7.&nbsp;Ranking factor aggregation functions</h3></div></div></div>
  2485. <p>
  2486. A <span class="bold"><strong>field aggregation function</strong></span> is a single argument function
  2487. that takes an expression with field-level factors, iterates it over
  2488. all the matched fields, and computes the final results.
  2489. Currently implemented field aggregation functions are:
  2490. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
  2491. <code class="code">sum</code>, sums the argument expression over all matched
  2492. fields. For instance, <code class="code">sum(1)</code> should return a number
  2493. of matched fields.
  2494. </p></li>
  2495. <li class="listitem"><p>
  2496. <code class="code">top</code>, returns the greatest value of the argument over all
  2497. matched fields.
  2498. </p></li>
  2499. </ul></div>
  2500. <p>
  2501. </p></div>
  2502. <div class="sect2" title="5.4.8.&nbsp;Formula expressions for all the built-in rankers"><div class="titlepage"><div><div><h3 class="title"><a name="formulas-for-builtin-rankers"></a>5.4.8.&nbsp;Formula expressions for all the built-in rankers</h3></div></div></div>
  2503. <p>
  2504. Most of the other rankers can actually be emulated with the expression
  2505. based ranker. You just need to pass a proper expression. Such emulation is,
  2506. of course, going to be slower than using the built-in, compiled ranker but
  2507. still might be of interest if you want to fine-tune your ranking formula
  2508. starting with one of the existing ones. Also, the formulas define the
  2509. nitty gritty ranker details in a nicely readable fashion.
  2510. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
  2511. SPH_RANK_PROXIMITY_BM25 = sum(lcs*user_weight)*1000+bm25
  2512. </p></li>
  2513. <li class="listitem"><p>
  2514. SPH_RANK_BM25 = bm25
  2515. </p></li>
  2516. <li class="listitem"><p>
  2517. SPH_RANK_NONE = 1
  2518. </p></li>
  2519. <li class="listitem"><p>
  2520. SPH_RANK_WORDCOUNT = sum(hit_count*user_weight)
  2521. </p></li>
  2522. <li class="listitem"><p>
  2523. SPH_RANK_PROXIMITY = sum(lcs*user_weight)
  2524. </p></li>
  2525. <li class="listitem"><p>
  2526. SPH_RANK_MATCHANY = sum((word_count+(lcs-1)*max_lcs)*user_weight)
  2527. </p></li>
  2528. <li class="listitem"><p>
  2529. SPH_RANK_FIELDMASK = field_mask
  2530. </p></li>
  2531. <li class="listitem"><p>
  2532. SPH_RANK_SPH04 = sum((4*lcs+2*(min_hit_pos==1)+exact_hit)*user_weight)*1000+bm25
  2533. </p></li>
  2534. </ul></div></div></div>
  2535. <div class="sect1" title="5.5.&nbsp;Expressions, functions, and operators"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="expressions"></a>5.5.&nbsp;Expressions, functions, and operators</h2></div></div></div>
  2536. <p>
  2537. Sphinx lets you use arbitrary arithmetic expressions both via SphinxQL
  2538. and SphinxAPI, involving attribute values, internal attributes (document ID
  2539. and relevance weight), arithmetic operations, a number of built-in functions,
  2540. and user-defined functions.
  2541. This section documents the supported operators and functions.
  2542. Here's the complete reference list for quick access.
  2543. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><a class="link" href="#expr-ari-ops">Arithmetic operators: +, -, *, /, %, DIV, MOD</a></p></li>
  2544. <li class="listitem"><p><a class="link" href="#expr-comp-ops">Comparison operators: &lt;, &gt; &lt;=, &gt;=, =, &lt;&gt;</a></p></li>
  2545. <li class="listitem"><p><a class="link" href="#expr-bool-ops">Boolean operators: AND, OR, NOT</a></p></li>
  2546. <li class="listitem"><p><a class="link" href="#expr-bitwise-ops">Bitwise operators: &amp;, |</a></p></li>
  2547. <li class="listitem"><p><a class="link" href="#expr-func-abs">ABS()</a></p></li>
  2548. <li class="listitem"><p><a class="link" href="#expr-func-all">ALL()</a></p></li>
  2549. <li class="listitem"><p><a class="link" href="#expr-func-any">ANY()</a></p></li>
  2550. <li class="listitem"><p><a class="link" href="#expr-func-atan2">ATAN2()</a></p></li>
  2551. <li class="listitem"><p><a class="link" href="#expr-func-bigint">BIGINT()</a></p></li>
  2552. <li class="listitem"><p><a class="link" href="#expr-func-bitdot">BITDOT()</a></p></li>
  2553. <li class="listitem"><p><a class="link" href="#expr-func-ceil">CEIL()</a></p></li>
  2554. <li class="listitem"><p><a class="link" href="#expr-func-contains">CONTAINS()</a></p></li>
  2555. <li class="listitem"><p><a class="link" href="#expr-func-cos">COS()</a></p></li>
  2556. <li class="listitem"><p><a class="link" href="#expr-func-crc32">CRC32()</a></p></li>
  2557. <li class="listitem"><p><a class="link" href="#expr-func-day">DAY()</a></p></li>
  2558. <li class="listitem"><p><a class="link" href="#expr-func-double">DOUBLE()</a></p></li>
  2559. <li class="listitem"><p><a class="link" href="#expr-func-exp">EXP()</a></p></li>
  2560. <li class="listitem"><p><a class="link" href="#expr-func-fibonacci">FIBONACCI()</a></p></li>
  2561. <li class="listitem"><p><a class="link" href="#expr-func-floor">FLOOR()</a></p></li>
  2562. <li class="listitem"><p><a class="link" href="#expr-func-geodist">GEODIST()</a></p></li>
  2563. <li class="listitem"><p><a class="link" href="#expr-func-geopoly2d">GEOPOLY2D()</a></p></li>
  2564. <li class="listitem"><p><a class="link" href="#expr-func-greatest">GREATEST()</a></p></li>
  2565. <li class="listitem"><p><a class="link" href="#expr-func-idiv">IDIV()</a></p></li>
  2566. <li class="listitem"><p><a class="link" href="#expr-func-if">IF()</a></p></li>
  2567. <li class="listitem"><p><a class="link" href="#expr-func-in">IN()</a></p></li>
  2568. <li class="listitem"><p><a class="link" href="#expr-func-indexof">INDEXOF()</a></p></li>
  2569. <li class="listitem"><p><a class="link" href="#expr-func-integer">INTEGER()</a></p></li>
  2570. <li class="listitem"><p><a class="link" href="#expr-func-interval">INTERVAL()</a></p></li>
  2571. <li class="listitem"><p><a class="link" href="#expr-func-least">LEAST()</a></p></li>
  2572. <li class="listitem"><p><a class="link" href="#expr-func-length">LENGTH()</a></p></li>
  2573. <li class="listitem"><p><a class="link" href="#expr-func-ln">LN()</a></p></li>
  2574. <li class="listitem"><p><a class="link" href="#expr-func-log10">LOG10()</a></p></li>
  2575. <li class="listitem"><p><a class="link" href="#expr-func-log2">LOG2()</a></p></li>
  2576. <li class="listitem"><p><a class="link" href="#expr-func-max">MAX()</a></p></li>
  2577. <li class="listitem"><p><a class="link" href="#expr-func-min">MIN()</a></p></li>
  2578. <li class="listitem"><p><a class="link" href="#expr-func-min-top-sortval">MIN_TOP_SORTVAL()</a></p></li>
  2579. <li class="listitem"><p><a class="link" href="#expr-func-min-top-weight">MIN_TOP_WEIGHT()</a></p></li>
  2580. <li class="listitem"><p><a class="link" href="#expr-func-month">MONTH()</a></p></li>
  2581. <li class="listitem"><p><a class="link" href="#expr-func-now">NOW()</a></p></li>
  2582. <li class="listitem"><p><a class="link" href="#expr-func-poly2d">POLY2D()</a></p></li>
  2583. <li class="listitem"><p><a class="link" href="#expr-func-pow">POW()</a></p></li>
  2584. <li class="listitem"><p><a class="link" href="#expr-func-remap">REMAP()</a></p></li>
  2585. <li class="listitem"><p><a class="link" href="#expr-func-sin">SIN()</a></p></li>
  2586. <li class="listitem"><p><a class="link" href="#expr-func-sint">SINT()</a></p></li>
  2587. <li class="listitem"><p><a class="link" href="#expr-func-sqrt">SQRT()</a></p></li>
  2588. <li class="listitem"><p><a class="link" href="#expr-func-uint">UINT()</a></p></li>
  2589. <li class="listitem"><p><a class="link" href="#expr-func-year">YEAR()</a></p></li>
  2590. <li class="listitem"><p><a class="link" href="#expr-func-yearmonth">YEARMONTH()</a></p></li>
  2591. <li class="listitem"><p><a class="link" href="#expr-func-yearmonthday">YEARMONTHDAY()</a></p></li>
  2592. </ul></div>
  2593. <p>
  2594. </p><div class="sect2" title="5.5.1.&nbsp;Operators"><div class="titlepage"><div><div><h3 class="title"><a name="operators"></a>5.5.1.&nbsp;Operators</h3></div></div></div>
  2595. <div class="variablelist"><dl><dt><span class="term"><a name="expr-ari-ops"></a>Arithmetic operators: +, -, *, /, %, DIV, MOD</span></dt>
  2596. <dd><p>
  2597. The standard arithmetic operators. Arithmetic calculations involving those
  2598. can be performed in three different modes: (a) using single-precision,
  2599. 32-bit IEEE 754 floating point values (the default), (b) using signed 32-bit integers,
  2600. (c) using 64-bit signed integers. The expression parser will automatically switch
  2601. to integer mode if there are no operations the result in a floating point value.
  2602. Otherwise, it will use the default floating point mode. For instance, <code class="code">a+b</code>
  2603. will be computed using 32-bit integers if both arguments are 32-bit integers;
  2604. or using 64-bit integers if both arguments are integers but one of them is
  2605. 64-bit; or in floats otherwise. However, <code class="code">a/b</code> or <code class="code">sqrt(a)</code>
  2606. will always be computed in floats, because these operations return a result
  2607. of non-integer type. To avoid the first, you can either use <code class="code">IDIV(a,b)</code>
  2608. or <code class="code">a DIV b</code> form. Also, <code class="code">a*b</code>
  2609. will not be automatically promoted to 64-bit when the arguments are 32-bit.
  2610. To enforce 64-bit results, you can use BIGINT(). (But note that if there are
  2611. non-integer operations, BIGINT() will simply be ignored.)
  2612. </p></dd><dt><span class="term"><a name="expr-comp-ops"></a>Comparison operators: &lt;, &gt; &lt;=, &gt;=, =, &lt;&gt;</span></dt>
  2613. <dd><p>
  2614. Comparison operators (eg. = or &lt;=) return 1.0 when the condition is true and 0.0 otherwise.
  2615. For instance, <code class="code">(a=b)+3</code> will evaluate to 4 when attribute 'a' is equal to attribute 'b', and to 3 when 'a' is not.
  2616. Unlike MySQL, the equality comparisons (ie. = and &lt;&gt; operators) introduce a small equality threshold (1e-6 by default).
  2617. If the difference between compared values is within the threshold, they will be considered equal.
  2618. </p></dd><dt><span class="term"><a name="expr-bool-ops"></a>Boolean operators: AND, OR, NOT</span></dt>
  2619. <dd><p>
  2620. Boolean operators (AND, OR, NOT) were introduced in 0.9.9-rc2 and behave as usual.
  2621. They are left-associative and have the least priority compared to other operators.
  2622. NOT has more priority than AND and OR but nevertheless less than any other operator.
  2623. AND and OR have the same priority so brackets use is recommended to avoid confusion
  2624. in complex expressions.
  2625. </p></dd><dt><span class="term"><a name="expr-bitwise-ops"></a>Bitwise operators: &amp;, |</span></dt>
  2626. <dd><p>
  2627. These operators perform bitwise AND and OR respectively. The operands
  2628. must be of an integer types. Introduced in version 1.10-beta.
  2629. </p></dd></dl></div></div>
  2630. <div class="sect2" title="5.5.2.&nbsp;Numeric functions"><div class="titlepage"><div><div><h3 class="title"><a name="numeric-functions"></a>5.5.2.&nbsp;Numeric functions</h3></div></div></div>
  2631. <div class="variablelist"><dl><dt><span class="term"><a name="expr-func-abs"></a>ABS()</span></dt>
  2632. <dd><p>Returns the absolute value of the argument.</p></dd><dt><span class="term"><a name="expr-func-bitdot"></a>BITDOT()</span></dt>
  2633. <dd><p>BITDOT(mask, w0, w1, ...) returns the sum of products of an each bit of a mask multiplied with its weight.
  2634. <code class="code">bit0*w0 + bit1*w1 + ...</code></p></dd><dt><span class="term"><a name="expr-func-ceil"></a>CEIL()</span></dt>
  2635. <dd><p>Returns the smallest integer value greater or equal to the argument.</p></dd><dt><span class="term"><a name="expr-func-contains"></a>CONTAINS()</span></dt>
  2636. <dd><p>CONTAINS(polygon, x, y) checks whether the (x,y) point is within the given polygon,
  2637. and returns 1 if true, or 0 if false. The polygon has to be specified using either the <a class="link" href="#expr-func-poly2d">POLY2D()</a> function
  2638. or the <a class="link" href="#expr-func-poly2d">GEOPOLY2D()</a> function. The former function is intended for "small" polygons, meaning less than
  2639. 500 km (300 miles) a side, and it doesn't take into account the Earth's curvature for speed. For larger
  2640. distances, you should use GEOPOLY2D, which tessellates the given polygon in smaller parts, accounting
  2641. for the Earth's curvature.
  2642. These functions were added in version 2.1.1-beta.
  2643. </p></dd><dt><span class="term"><a name="expr-func-cos"></a>COS()</span></dt>
  2644. <dd><p>Returns the cosine of the argument.</p></dd><dt><span class="term"><a name="expr-func-double"></a>DOUBLE()</span></dt>
  2645. <dd><p>Forcibly promotes given argument to floating point type. Intended to help enforce evaluation of numeric JSON fields. Introduced in version 2.2.1-beta.</p></dd><dt><span class="term"><a name="expr-func-exp"></a>EXP()</span></dt>
  2646. <dd><p>Returns the exponent of the argument (e=2.718... to the power of the argument).</p></dd><dt><span class="term"><a name="expr-func-fibonacci"></a>FIBONACCI()</span></dt>
  2647. <dd><p>Returns the N-th Fibonacci number, where N is the integer
  2648. argument. That is, arguments of 0 and up will generate the values 0, 1, 1,
  2649. 2, 3, 5, 8, 13 and so on. Note that the computations are done using 32-bit
  2650. integer math and thus numbers 48th and up will be returned modulo 2^32.
  2651. </p></dd><dt><span class="term"><a name="expr-func-floor"></a>FLOOR()</span></dt>
  2652. <dd><p>Returns the largest integer value lesser or equal to the argument.</p></dd><dt><span class="term"><a name="expr-func-geopoly2d"></a>GEOPOLY2D()</span></dt>
  2653. <dd><p>GEOPOLY2D(x1,y1,x2,y2,x3,y3...) produces a polygon to be used with the <a class="link" href="#expr-func-contains">CONTAINS()</a> function.
  2654. This function takes into account the Earth's curvature by tessellating the polygon into smaller ones,
  2655. and should be used for larger areas; see the <a class="link" href="#expr-func-poly2d">POLY2D()</a> function.
  2656. </p></dd><dt><span class="term"><a name="expr-func-idiv"></a>IDIV()</span></dt>
  2657. <dd><p>
  2658. Returns the result of an integer division of the first
  2659. argument by the second argument. Both arguments must be
  2660. of an integer type.
  2661. </p></dd><dt><span class="term"><a name="expr-func-ln"></a>LN()</span></dt>
  2662. <dd><p>Returns the natural logarithm of the argument (with the base of e=2.718...).</p></dd><dt><span class="term"><a name="expr-func-log10"></a>LOG10()</span></dt>
  2663. <dd><p>Returns the common logarithm of the argument (with the base of 10).</p></dd><dt><span class="term"><a name="expr-func-log2"></a>LOG2()</span></dt>
  2664. <dd><p>Returns the binary logarithm of the argument (with the base of 2).</p></dd><dt><span class="term"><a name="expr-func-max"></a>MAX()</span></dt>
  2665. <dd><p>Returns the bigger of two arguments.</p></dd><dt><span class="term"><a name="expr-func-min"></a>MIN()</span></dt>
  2666. <dd><p>Returns the smaller of two arguments.</p></dd><dt><span class="term"><a name="expr-func-poly2d"></a>POLY2D()</span></dt>
  2667. <dd><p>POLY2D(x1,y1,x2,y2,x3,y3...) produces a polygon to be used with the <a class="link" href="#expr-func-contains">CONTAINS()</a> function.
  2668. This polygon assumes a flat Earth, so it should not be too large; see the <a class="link" href="#expr-func-poly2d">POLY2D()</a> function.
  2669. </p></dd><dt><span class="term"><a name="expr-func-pow"></a>POW()</span></dt>
  2670. <dd><p>Returns the first argument raised to the power of the second argument.</p></dd><dt><span class="term"><a name="expr-func-sin"></a>SIN()</span></dt>
  2671. <dd><p>Returns the sine of the argument.</p></dd><dt><span class="term"><a name="expr-func-sqrt"></a>SQRT()</span></dt>
  2672. <dd><p>Returns the square root of the argument.</p></dd><dt><span class="term"><a name="expr-func-uint"></a>UINT()</span></dt>
  2673. <dd><p>Forcibly reinterprets given argument to 64-bit unsigned type. Introduced in version 2.2.1-beta.</p></dd></dl></div></div>
  2674. <div class="sect2" title="5.5.3.&nbsp;Date and time functions"><div class="titlepage"><div><div><h3 class="title"><a name="date-time-functions"></a>5.5.3.&nbsp;Date and time functions</h3></div></div></div>
  2675. <div class="variablelist"><dl><dt><span class="term"><a name="expr-func-day"></a>DAY()</span></dt>
  2676. <dd><p>Returns the integer day of month (in 1..31 range) from a timestamp argument, according to the current timezone. Introduced in version 2.0.1-beta.</p></dd><dt><span class="term"><a name="expr-func-month"></a>MONTH()</span></dt>
  2677. <dd><p>Returns the integer month (in 1..12 range) from a timestamp argument, according to the current timezone. Introduced in version 2.0.1-beta.</p></dd><dt><span class="term"><a name="expr-func-now"></a>NOW()</span></dt>
  2678. <dd><p>Returns the current timestamp as an INTEGER. Introduced in version 0.9.9-rc1.</p></dd><dt><span class="term"><a name="expr-func-year"></a>YEAR()</span></dt>
  2679. <dd><p>Returns the integer year (in 1969..2038 range) from a timestamp argument, according to the current timezone. Introduced in version 2.0.1-beta.</p></dd><dt><span class="term"><a name="expr-func-yearmonth"></a>YEARMONTH()</span></dt>
  2680. <dd><p>Returns the integer year and month code (in 196912..203801 range) from a timestamp argument, according to the current timezone. Introduced in version 2.0.1-beta.</p></dd><dt><span class="term"><a name="expr-func-yearmonthday"></a>YEARMONTHDAY()</span></dt>
  2681. <dd><p>Returns the integer year, month, and date code (in 19691231..20380119 range) from a timestamp argument, according to the current timezone. Introduced in version 2.0.1-beta.</p></dd></dl></div></div>
  2682. <div class="sect2" title="5.5.4.&nbsp;Type conversion functions"><div class="titlepage"><div><div><h3 class="title"><a name="type-conversion-functions"></a>5.5.4.&nbsp;Type conversion functions</h3></div></div></div>
  2683. <div class="variablelist"><dl><dt><span class="term"><a name="expr-func-bigint"></a>BIGINT()</span></dt>
  2684. <dd><p>
  2685. Forcibly promotes the integer argument to 64-bit type,
  2686. and does nothing on floating point argument. It's intended to help enforce evaluation
  2687. of certain expressions (such as <code class="code">a*b</code>) in 64-bit mode even though all the arguments
  2688. are 32-bit.
  2689. Introduced in version 0.9.9-rc1.
  2690. </p></dd><dt><span class="term"><a name="expr-func-integer"></a>INTEGER()</span></dt>
  2691. <dd><p>Forcibly promotes given argument to 64-bit signed type. Intended to help enforce evaluation of numeric JSON fields. Introduced in version 2.2.1-beta.</p></dd><dt><span class="term"><a name="expr-func-sint"></a>SINT()</span></dt>
  2692. <dd><p>
  2693. Forcibly reinterprets its
  2694. 32-bit unsigned integer argument as signed, and also expands it to 64-bit type
  2695. (because 32-bit type is unsigned). It's easily illustrated by the following
  2696. example: 1-2 normally evaluates to 4294967295, but SINT(1-2) evaluates to -1.
  2697. Introduced in version 1.10-beta.
  2698. </p></dd></dl></div></div>
  2699. <div class="sect2" title="5.5.5.&nbsp;Comparison functions"><div class="titlepage"><div><div><h3 class="title"><a name="comparison-functions"></a>5.5.5.&nbsp;Comparison functions</h3></div></div></div>
  2700. <div class="variablelist"><dl><dt><span class="term"><a name="expr-func-if"></a>IF()</span></dt>
  2701. <dd><p>
  2702. <code class="code">IF()</code> behavior is slightly different that that of its MySQL counterpart.
  2703. It takes 3 arguments, check whether the 1st argument is equal to 0.0, returns the 2nd argument if it is not zero, or the 3rd one when it is.
  2704. Note that unlike comparison operators, <code class="code">IF()</code> does <span class="bold"><strong>not</strong></span> use a threshold!
  2705. Therefore, it's safe to use comparison results as its 1st argument, but arithmetic operators might produce unexpected results.
  2706. For instance, the following two calls will produce <span class="emphasis"><em>different</em></span> results even though they are logically equivalent:
  2707. </p><pre class="programlisting">
  2708. IF ( sqrt(3)*sqrt(3)-3&lt;&gt;0, a, b )
  2709. IF ( sqrt(3)*sqrt(3)-3, a, b )
  2710. </pre><p>
  2711. In the first case, the comparison operator &lt;&gt; will return 0.0 (false)
  2712. because of a threshold, and <code class="code">IF()</code> will always return 'b' as a result.
  2713. In the second one, the same <code class="code">sqrt(3)*sqrt(3)-3</code> expression will be compared
  2714. with zero <span class="emphasis"><em>without</em></span> threshold by the <code class="code">IF()</code> function itself.
  2715. But its value will be slightly different from zero because of limited floating point
  2716. calculations precision. Because of that, the comparison with 0.0 done by <code class="code">IF()</code>
  2717. will not pass, and the second variant will return 'a' as a result.
  2718. </p></dd><dt><span class="term"><a name="expr-func-in"></a>IN()</span></dt>
  2719. <dd><p>
  2720. IN(expr,val1,val2,...), introduced in version 0.9.9-rc1, takes 2 or more arguments, and returns 1 if 1st argument
  2721. (expr) is equal to any of the other arguments (val1..valN), or 0 otherwise.
  2722. Currently, all the checked values (but not the expression itself!) are required
  2723. to be constant. (Its technically possible to implement arbitrary expressions too,
  2724. and that might be implemented in the future.) Constants are pre-sorted and then
  2725. binary search is used, so IN() even against a big arbitrary list of constants
  2726. will be very quick. Starting with 0.9.9-rc2, first argument can also be
  2727. a MVA attribute. In that case, IN() will return 1 if any of the MVA values
  2728. is equal to any of the other arguments. Starting with 2.0.1-beta, IN() also
  2729. supports <code class="code">IN(expr,@uservar)</code> syntax to check whether the value
  2730. belongs to the list in the given global user variable. First argument can be
  2731. JSON attribute since 2.2.1-beta.
  2732. </p></dd><dt><span class="term"><a name="expr-func-interval"></a>INTERVAL()</span></dt>
  2733. <dd><p>
  2734. INTERVAL(expr,point1,point2,point3,...), introduced in version 0.9.9-rc1, takes 2 or more arguments, and returns
  2735. the index of the argument that is less than the first argument: it returns
  2736. 0 if expr&lt;point1, 1 if point1&lt;=expr&lt;point2, and so on.
  2737. It is required that point1&lt;point2&lt;...&lt;pointN for this function
  2738. to work correctly.
  2739. </p></dd></dl></div></div>
  2740. <div class="sect2" title="5.5.6.&nbsp;Miscellaneous functions"><div class="titlepage"><div><div><h3 class="title"><a name="misc-functions"></a>5.5.6.&nbsp;Miscellaneous functions</h3></div></div></div>
  2741. <div class="variablelist"><dl><dt><span class="term"><a name="expr-func-all"></a>ALL()</span></dt>
  2742. <dd><p>ALL(cond FOR var IN json.array) function was introduced in 2.2.1-beta. It
  2743. applies to JSON arrays and returns 1 if condition is true for all elements in
  2744. array and 0 otherwise. 'cond' is a general expression which additionally can use
  2745. 'var' as current value of an array element within itself.</p><pre class="programlisting">
  2746. SELECT ALL(x&gt;3 AND x&lt;7 FOR x IN j.intarray) FROM test;
  2747. </pre></dd><dt><span class="term"><a name="expr-func-any"></a>ANY()</span></dt>
  2748. <dd><p>ANY(cond FOR var IN json.array) function was introduced in 2.2.1-beta.
  2749. It works similar to <a class="link" href="#expr-func-all">ALL()</a> except for it
  2750. returns 1 if condition is true for any element in array.</p></dd><dt><span class="term"><a name="expr-func-atan2"></a>ATAN2()</span></dt>
  2751. <dd><p>
  2752. Returns the arctangent function of two arguments, expressed in <span class="bold"><strong>radians</strong></span>.
  2753. </p></dd><dt><span class="term"><a name="expr-func-crc32"></a>CRC32()</span></dt>
  2754. <dd><p>
  2755. Returns the CRC32 value of a string argument. Introduced in version 2.0.1-beta.
  2756. </p></dd><dt><span class="term"><a name="expr-func-geodist"></a>GEODIST()</span></dt>
  2757. <dd><p>
  2758. GEODIST(lat1, lon1, lat2, lon2, [...]) function, introduced in version 0.9.9-rc2,
  2759. computes geosphere distance between two given points specified by their
  2760. coordinates. Note that by default both latitudes and longitudes must be in <span class="bold"><strong>radians</strong></span>
  2761. and the result will be in <span class="bold"><strong>meters</strong></span>. You can use arbitrary expression as any
  2762. of the four coordinates. An optimized path will be selected when one pair
  2763. of the arguments refers directly to a pair attributes and the other one
  2764. is constant.
  2765. </p><p>
  2766. Starting with version 2.2.1-beta, GEODIST() also takes an optional 5th argument
  2767. that lets you easily convert between input and output units, and pick the specific
  2768. geodistance formula to use. The complete syntax and a few examples are as follows:
  2769. </p><pre class="programlisting">
  2770. GEODIST(lat1, lon1, lat2, lon2, { option=value, ... })
  2771. GEODIST(40.7643929, -73.9997683, 40.7642578, -73.9994565, {in=degrees, out=feet})
  2772. GEODIST(51.50, -0.12, 29.98, 31.13, {in=deg, out=mi}}
  2773. </pre><p>
  2774. The known options and their values are:
  2775. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><code class="code">in = {deg | degrees | rad | radians}</code>, specifies the input units;</li>
  2776. <li class="listitem"><code class="code">out = {m | meters | km | kilometers | ft | feet | mi | miles}</code>, specifies the output units;</li>
  2777. <li class="listitem"><code class="code">method = {haversine | adaptive}</code>, specifies the geodistance calculation method.</li>
  2778. </ul></div>
  2779. <p>
  2780. Upto version 2.1.x (inclusive), "haversine" method was the default.
  2781. Starting with 2.2.1-beta, the default method changed to "adaptive",
  2782. a new, well optimized implementation that is both more precise
  2783. <span class="emphasis"><em>and</em></span> much faster at all times.
  2784. </p></dd><dt><span class="term"><a name="expr-func-greatest"></a>GREATEST()</span></dt>
  2785. <dd><p>
  2786. GREATEST(attr_json.some_array) was introduced in version 2.2.1-beta. First argument
  2787. is JSON array and return value is the greatest value in that array.
  2788. Also works for MVA.
  2789. </p></dd><dt><span class="term"><a name="expr-func-indexof"></a>INDEXOF()</span></dt>
  2790. <dd><p>INDEXOF(cond FOR var IN json.array) function was introduced in 2.2.1-beta. It
  2791. iterates through all elements in array and returns index of first element for which
  2792. 'cond' is true and -1 if 'cond' is false for every element in array.</p><pre class="programlisting">
  2793. SELECT INDEXOF(name='John' FOR name IN j.peoples) FROM test;
  2794. </pre></dd><dt><span class="term"><a name="expr-func-least"></a>LEAST()</span></dt>
  2795. <dd><p>
  2796. LEAST(attr_json.some_array) was introduced in version 2.2.1-beta. First argument
  2797. is JSON array and return value is the least value in that array.
  2798. Also works for MVA.
  2799. </p></dd><dt><span class="term"><a name="expr-func-length"></a>LENGTH()</span></dt>
  2800. <dd><p>
  2801. LENGTH(attr_mva) function, introduced in version 2.1.2-stable,
  2802. returns amount of elements in MVA set. It works with both 32-bit and
  2803. 64-bit MVA attributes.
  2804. LENGTH(attr_json) was introduced in version 2.2.1-beta. It returns length of
  2805. a field in JSON. Return value depends on type of a field.
  2806. For example LENGTH(json_attr.some_int) always returns 1 and
  2807. LENGTH(json_attr.some_array) returns number of elements in array.
  2808. </p></dd><dt><span class="term"><a name="expr-func-min-top-sortval"></a>MIN_TOP_SORTVAL()</span></dt>
  2809. <dd><p>Returns sort key value of the worst found element in the current top-N matches if sort key is float and 0 otherwise.</p></dd><dt><span class="term"><a name="expr-func-min-top-weight"></a>MIN_TOP_WEIGHT()</span></dt>
  2810. <dd><p>Returns weight of the worst found element in the current top-N matches.</p></dd><dt><span class="term"><a name="expr-func-packedfactors"></a>PACKEDFACTORS()</span></dt>
  2811. <dd><p>
  2812. PACKEDFACTORS(), introduced in version 2.1.1-beta, can be used in queries,
  2813. either to just see all the weighting factors calculated when doing the matching, or to
  2814. provide a binary attribute that can be used to write a custom ranking UDF.
  2815. This function works only if expression ranker is specified and the query
  2816. is not a full scan, otherwise it will return an error. Starting with 2.2.2-beta
  2817. PACKEDFACTORS() can take an optional argument that disables ATC ranking factor calculation:
  2818. </p><pre class="programlisting">
  2819. PACKEDFACTORS({no_atc=1})
  2820. </pre><p>
  2821. Calculating ATC slows down query processing considerably, so this option can be useful
  2822. if you need to see the ranking factors, but do not need ATC.
  2823. Starting with 2.2.3-beta PACKEDFACTORS() can also be told to format its output as JSON:
  2824. </p><pre class="programlisting">
  2825. PACKEDFACTORS({json=1})
  2826. </pre><p>
  2827. The respective outputs in either key-value pair or JSON format would look
  2828. as follows below. (Note that the examples below are wrapped for readability;
  2829. actual returned values would be single-line.)
  2830. </p><pre class="programlisting">
  2831. mysql&gt; SELECT id, PACKEDFACTORS() FROM test1
  2832. -&gt; WHERE MATCH('test one') OPTION ranker=expr('1') \G
  2833. *************************** 1. row ***************************
  2834. id: 1
  2835. packedfactors(): bm25=569, bm25a=0.617197, field_mask=2, doc_word_count=2,
  2836. field1=(lcs=1, hit_count=2, word_count=2, tf_idf=0.152356,
  2837. min_idf=-0.062982, max_idf=0.215338, sum_idf=0.152356, min_hit_pos=4,
  2838. min_best_span_pos=4, exact_hit=0, max_window_hits=1, min_gaps=2,
  2839. exact_order=1, lccs=1, wlccs=0.215338, atc=-0.003974),
  2840. word0=(tf=1, idf=-0.062982),
  2841. word1=(tf=1, idf=0.215338)
  2842. 1 row in set (0.00 sec)
  2843. mysql&gt; SELECT id, PACKEDFACTORS({json=1}) FROM test1
  2844. -&gt; WHERE MATCH('test one') OPTION ranker=expr('1') \G
  2845. *************************** 1. row ***************************
  2846. id: 1
  2847. packedfactors({json=1}):
  2848. {
  2849. "bm25": 569,
  2850. "bm25a": 0.617197,
  2851. "field_mask": 2,
  2852. "doc_word_count": 2,
  2853. "fields": [
  2854. {
  2855. "lcs": 1,
  2856. "hit_count": 2,
  2857. "word_count": 2,
  2858. "tf_idf": 0.152356,
  2859. "min_idf": -0.062982,
  2860. "max_idf": 0.215338,
  2861. "sum_idf": 0.152356,
  2862. "min_hit_pos": 4,
  2863. "min_best_span_pos": 4,
  2864. "exact_hit": 0,
  2865. "max_window_hits": 1,
  2866. "min_gaps": 2,
  2867. "exact_order": 1,
  2868. "lccs": 1,
  2869. "wlccs": 0.215338,
  2870. "atc": -0.003974
  2871. }
  2872. ],
  2873. "words": [
  2874. {
  2875. "tf": 1,
  2876. "idf": -0.062982
  2877. },
  2878. {
  2879. "tf": 1,
  2880. "idf": 0.215338
  2881. }
  2882. ]
  2883. }
  2884. 1 row in set (0.01 sec)
  2885. </pre><p>
  2886. </p><p>
  2887. This function can be used to implement custom ranking functions in UDFs, as in
  2888. </p><pre class="programlisting">
  2889. SELECT *, CUSTOM_RANK(PACKEDFACTORS()) AS r
  2890. FROM my_index
  2891. WHERE match('hello')
  2892. ORDER BY r DESC
  2893. OPTION ranker=expr('1');
  2894. </pre><p>
  2895. Where CUSTOM_RANK() is a function implemented in an UDF. It should declare a
  2896. SPH_UDF_FACTORS structure (defined in <code class="filename">sphinxudf.h</code>), initialize this structure,
  2897. unpack the factors into it before usage, and deinitialize it afterwards, as follows:
  2898. </p><pre class="programlisting">
  2899. SPH_UDF_FACTORS factors;
  2900. sphinx_factors_init(&amp;factors);
  2901. sphinx_factors_unpack((DWORD*)args-&gt;arg_values[0], &amp;factors);
  2902. // ... can use the contents of factors variable here ...
  2903. sphinx_factors_deinit(&amp;factors);
  2904. </pre><p>
  2905. </p><p>
  2906. PACKEDFACTORS() data is available at all query stages, not just
  2907. when doing the initial matching and ranking pass. That enables
  2908. another particularly interesting application of PACKEDFACTORS(),
  2909. namely <span class="bold"><strong>re-ranking</strong></span>.
  2910. </p><p>
  2911. In the example just above, we used an expression-based ranker with
  2912. a dummy expression, and sorted the result set by the value computed
  2913. by our UDF. In other words, we used the UDF to <span class="emphasis"><em>rank</em></span>
  2914. all our results. Assume now, for the sake of an example, that our UDF
  2915. is extremely expensive to compute and has a throughput of just
  2916. 10,000 calls per second. Assume that our query matches 1,000,000 documents.
  2917. To maintain reasonable performance, we would then want to use a (much)
  2918. simpler expression to do most of our ranking, and then apply the
  2919. expensive UDF to only a few top results, say, top-100 results.
  2920. Or, in other words, build top-100 results using a simpler ranking
  2921. function and then <span class="emphasis"><em>re-rank</em></span> those with a complex one.
  2922. We can do that just as well with subselects:
  2923. </p><pre class="programlisting">
  2924. SELECT * FROM (
  2925. SELECT *, CUSTOM_RANK(PACKEDFACTORS()) AS r
  2926. FROM my_index WHERE match('hello')
  2927. OPTION ranker=expr('sum(lcs)*1000+bm25')
  2928. ORDER BY WEIGHT() DESC
  2929. LIMIT 100
  2930. ) ORDER BY r DESC LIMIT 10
  2931. </pre><p>
  2932. In this example, expression-based ranker will be called for every
  2933. matched document to compute WEIGHT(). So it will get called 1,000,000
  2934. times. But the UDF computation can be postponed until the outer sort.
  2935. And it also will be done for just the top-100 matches by WEIGHT(),
  2936. according to the inner limit. So the UDF will only get called 100 times.
  2937. And then the final top-10 matches by UDF value will be selected
  2938. and returned to the application.
  2939. </p><p>
  2940. For reference, in the distributed case PACKEDFACTORS() data gets
  2941. sent from the agents to master in a binary format, too. This makes
  2942. it technically feasible to implement additional re-ranking pass
  2943. (or passes) on the master node, if needed.
  2944. </p><p>
  2945. If used with SphinxQL but not called from any UDFs, the result of PACKEDFACTORS()
  2946. is simply formatted as plain text, which can be used to manually assess the ranking
  2947. factors. Note that this feature is not currently supported by the Sphinx API.
  2948. </p></dd><dt><span class="term"><a name="expr-func-remap"></a>REMAP()</span></dt>
  2949. <dd><p>
  2950. REMAP(condition, expression, (cond1, cond2, ...), (expr1, expr2, ...)) function
  2951. was added in 2.2.2-beta. It allows you to make some exceptions of an expression
  2952. values depending on condition values. Condition expression should always result
  2953. integer, expression can result in integer or float.
  2954. </p><pre class="programlisting">
  2955. SELECT REMAP(userid, karmapoints, (1, 67), (999, 0)) FROM users;
  2956. SELECT REMAP(id%10, salary, (0), (0.0)) FROM employes;
  2957. </pre><p>
  2958. </p></dd></dl></div></div></div>
  2959. <div class="sect1" title="5.6.&nbsp;Sorting modes"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sorting-modes"></a>5.6.&nbsp;Sorting modes</h2></div></div></div>
  2960. <p>
  2961. There are the following result sorting modes available:
  2962. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>SPH_SORT_RELEVANCE mode, that sorts by relevance in descending order (best matches first);</p></li>
  2963. <li class="listitem"><p>SPH_SORT_ATTR_DESC mode, that sorts by an attribute in descending order (bigger attribute values first);</p></li>
  2964. <li class="listitem"><p>SPH_SORT_ATTR_ASC mode, that sorts by an attribute in ascending order (smaller attribute values first);</p></li>
  2965. <li class="listitem"><p>SPH_SORT_TIME_SEGMENTS mode, that sorts by time segments (last hour/day/week/month) in descending order, and then by relevance in descending order;</p></li>
  2966. <li class="listitem"><p>SPH_SORT_EXTENDED mode, that sorts by SQL-like combination of columns in ASC/DESC order;</p></li>
  2967. <li class="listitem"><p>SPH_SORT_EXPR mode, that sorts by an arithmetic expression.</p></li>
  2968. </ul></div>
  2969. <p>
  2970. </p><p>
  2971. SPH_SORT_RELEVANCE ignores any additional parameters and always sorts matches
  2972. by relevance rank. All other modes require an additional sorting clause, with the
  2973. syntax depending on specific mode. SPH_SORT_ATTR_ASC, SPH_SORT_ATTR_DESC and
  2974. SPH_SORT_TIME_SEGMENTS modes require simply an attribute name.
  2975. SPH_SORT_RELEVANCE is equivalent to sorting by "@weight DESC, @id ASC" in extended sorting mode,
  2976. SPH_SORT_ATTR_ASC is equivalent to "attribute ASC, @weight DESC, @id ASC",
  2977. and SPH_SORT_ATTR_DESC to "attribute DESC, @weight DESC, @id ASC" respectively.
  2978. </p><h3><a name="idp31775520"></a>SPH_SORT_TIME_SEGMENTS mode</h3><p>
  2979. In SPH_SORT_TIME_SEGMENTS mode, attribute values are split into so-called
  2980. time segments, and then sorted by time segment first, and by relevance second.
  2981. </p><p>
  2982. The segments are calculated according to the <span class="emphasis"><em>current timestamp</em></span>
  2983. at the time when the search is performed, so the results would change over time.
  2984. The segments are as follows:
  2985. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>last hour,</p></li>
  2986. <li class="listitem"><p>last day,</p></li>
  2987. <li class="listitem"><p>last week,</p></li>
  2988. <li class="listitem"><p>last month,</p></li>
  2989. <li class="listitem"><p>last 3 months,</p></li>
  2990. <li class="listitem"><p>everything else.</p></li>
  2991. </ul></div>
  2992. <p>
  2993. These segments are hardcoded, but it is trivial to change them if necessary.
  2994. </p><p>
  2995. This mode was added to support searching through blogs, news headlines, etc.
  2996. When using time segments, recent records would be ranked higher because of segment,
  2997. but within the same segment, more relevant records would be ranked higher -
  2998. unlike sorting by just the timestamp attribute, which would not take relevance
  2999. into account at all.
  3000. </p><h3><a name="sort-extended"></a>SPH_SORT_EXTENDED mode</h3><p>
  3001. In SPH_SORT_EXTENDED mode, you can specify an SQL-like sort expression
  3002. with up to 5 attributes (including internal attributes), eg:
  3003. </p><pre class="programlisting">
  3004. @relevance DESC, price ASC, @id DESC
  3005. </pre><p>
  3006. </p><p>
  3007. Both internal attributes (that are computed by the engine on the fly)
  3008. and user attributes that were configured for this index are allowed.
  3009. Internal attribute names must start with magic @-symbol; user attribute
  3010. names can be used as is. In the example above, <code class="option">@relevance</code>
  3011. and <code class="option">@id</code> are internal attributes and <code class="option">price</code> is user-specified.
  3012. </p><p>
  3013. Known internal attributes are:
  3014. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>@id (match ID)</p></li>
  3015. <li class="listitem"><p>@weight (match weight)</p></li>
  3016. <li class="listitem"><p>@rank (match weight)</p></li>
  3017. <li class="listitem"><p>@relevance (match weight)</p></li>
  3018. <li class="listitem"><p>@random (return results in random order)</p></li>
  3019. </ul></div>
  3020. <p>
  3021. <code class="option">@rank</code> and <code class="option">@relevance</code> are just additional
  3022. aliases to <code class="option">@weight</code>.
  3023. </p><h3><a name="sort-expr"></a>SPH_SORT_EXPR mode</h3><p>
  3024. Expression sorting mode lets you sort the matches by an arbitrary arithmetic
  3025. expression, involving attribute values, internal attributes (@id and @weight),
  3026. arithmetic operations, and a number of built-in functions. Here's an example:
  3027. </p><pre class="programlisting">
  3028. $cl-&gt;SetSortMode ( SPH_SORT_EXPR,
  3029. "@weight + ( user_karma + ln(pageviews) )*0.1" );
  3030. </pre><p>
  3031. The operators and functions supported in the expressions are discussed
  3032. in a separate section, <a class="xref" href="#expressions" title="5.5.&nbsp;Expressions, functions, and operators">Section&nbsp;5.5, &#8220;Expressions, functions, and operators&#8221;</a>.
  3033. </p></div>
  3034. <div class="sect1" title="5.7.&nbsp;Grouping (clustering) search results"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="clustering"></a>5.7.&nbsp;Grouping (clustering) search results </h2></div></div></div>
  3035. <p>
  3036. Sometimes it could be useful to group (or in other terms, cluster)
  3037. search results and/or count per-group match counts - for instance,
  3038. to draw a nice graph of how much matching blog posts were there per
  3039. each month; or to group Web search results by site; or to group
  3040. matching forum posts by author; etc.
  3041. </p><p>
  3042. In theory, this could be performed by doing only the full-text search
  3043. in Sphinx and then using found IDs to group on SQL server side. However,
  3044. in practice doing this with a big result set (10K-10M matches) would
  3045. typically kill performance.
  3046. </p><p>
  3047. To avoid that, Sphinx offers so-called grouping mode. It is enabled
  3048. with SetGroupBy() API call. When grouping, all matches are assigned to
  3049. different groups based on group-by value. This value is computed from
  3050. specified attribute using one of the following built-in functions:
  3051. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>SPH_GROUPBY_DAY, extracts year, month and day in YYYYMMDD format from timestamp;</p></li>
  3052. <li class="listitem"><p>SPH_GROUPBY_WEEK, extracts year and first day of the week number (counting from year start) in YYYYNNN format from timestamp;</p></li>
  3053. <li class="listitem"><p>SPH_GROUPBY_MONTH, extracts month in YYYYMM format from timestamp;</p></li>
  3054. <li class="listitem"><p>SPH_GROUPBY_YEAR, extracts year in YYYY format from timestamp;</p></li>
  3055. <li class="listitem"><p>SPH_GROUPBY_ATTR, uses attribute value itself for grouping.</p></li>
  3056. </ul></div>
  3057. <p>
  3058. </p><p>
  3059. The final search result set then contains one best match per group.
  3060. Grouping function value and per-group match count are returned along
  3061. as "virtual" attributes named
  3062. <span class="bold"><strong>@group</strong></span> and
  3063. <span class="bold"><strong>@count</strong></span> respectively.
  3064. </p><p>
  3065. The result set is sorted by group-by sorting clause, with the syntax similar
  3066. to <a class="link" href="#sort-extended" title="5.6.&nbsp;SPH_SORT_EXTENDED mode"><code class="option">SPH_SORT_EXTENDED</code> sorting clause</a>
  3067. syntax. In addition to <code class="option">@id</code> and <code class="option">@weight</code>,
  3068. group-by sorting clause may also include:
  3069. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>@group (groupby function value),</p></li>
  3070. <li class="listitem"><p>@count (amount of matches in group).</p></li>
  3071. </ul></div>
  3072. <p>
  3073. </p><p>
  3074. The default mode is to sort by groupby value in descending order,
  3075. ie. by <code class="option">"@group desc"</code>.
  3076. </p><p>
  3077. On completion, <code class="option">total_found</code> result parameter would
  3078. contain total amount of matching groups over he whole index.
  3079. </p><p>
  3080. <span class="bold"><strong>WARNING:</strong></span> grouping is done in fixed memory
  3081. and thus its results are only approximate; so there might be more groups reported
  3082. in <code class="option">total_found</code> than actually present. <code class="option">@count</code> might also
  3083. be underestimated. To reduce inaccuracy, one should raise <code class="option">max_matches</code>.
  3084. If <code class="option">max_matches</code> allows to store all found groups, results will be 100% correct.
  3085. </p><p>
  3086. For example, if sorting by relevance and grouping by <code class="code">"published"</code>
  3087. attribute with <code class="code">SPH_GROUPBY_DAY</code> function, then the result set will
  3088. contain
  3089. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>one most relevant match per each day when there were any
  3090. matches published,</p></li>
  3091. <li class="listitem"><p>with day number and per-day match count attached,</p></li>
  3092. <li class="listitem"><p>sorted by day number in descending order (ie. recent days first).</p></li>
  3093. </ul></div>
  3094. <p>
  3095. </p><p>
  3096. Starting with version 0.9.9-rc2, aggregate functions (AVG(), MIN(),
  3097. MAX(), SUM()) are supported through <a class="link" href="#api-func-setselect" title="9.2.4.&nbsp;SetSelect">SetSelect()</a> API call
  3098. when using GROUP BY.
  3099. </p></div>
  3100. <div class="sect1" title="5.8.&nbsp;Distributed searching"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="distributed"></a>5.8.&nbsp;Distributed searching</h2></div></div></div>
  3101. <p>
  3102. To scale well, Sphinx has distributed searching capabilities.
  3103. Distributed searching is useful to improve query latency (ie. search
  3104. time) and throughput (ie. max queries/sec) in multi-server, multi-CPU
  3105. or multi-core environments. This is essential for applications which
  3106. need to search through huge amounts data (ie. billions of records
  3107. and terabytes of text).
  3108. </p><p>
  3109. The key idea is to horizontally partition (HP) searched data
  3110. across search nodes and then process it in parallel.
  3111. </p><p>
  3112. Partitioning is done manually. You should
  3113. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>setup several instances
  3114. of Sphinx programs (<code class="filename">indexer</code> and <code class="filename">searchd</code>)
  3115. on different servers;</p></li>
  3116. <li class="listitem"><p>make the instances index (and search) different parts of data;</p></li>
  3117. <li class="listitem"><p>configure a special distributed index on some of the <code class="filename">searchd</code>
  3118. instances;</p></li>
  3119. <li class="listitem"><p>and query this index.</p></li>
  3120. </ul></div>
  3121. <p>
  3122. This index only contains references to other
  3123. local and remote indexes - so it could not be directly reindexed,
  3124. and you should reindex those indexes which it references instead.
  3125. </p><p>
  3126. When <code class="filename">searchd</code> receives a query against distributed index,
  3127. it does the following:
  3128. </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>connects to configured remote agents;</p></li>
  3129. <li class="listitem"><p>issues the query;</p></li>
  3130. <li class="listitem"><p>sequentially searches configured local indexes (while the remote agents are searching);</p></li>
  3131. <li class="listitem"><p>retrieves remote agents' search results;</p></li>
  3132. <li class="listitem"><p>merges all the results together, removing the duplicates;</p></li>
  3133. <li class="listitem"><p>sends the merged results to client.</p></li>
  3134. </ol></div>
  3135. <p>
  3136. </p><p>
  3137. From the application's point of view, there are no differences
  3138. between searching through a regular index, or a distributed index at all.
  3139. That is, distributed indexes are fully transparent to the application,
  3140. and actually there's no way to tell whether the index you queried
  3141. was distributed or local. (Even though as of 0.9.9 Sphinx does not
  3142. allow to combine searching through distributed indexes with anything else,
  3143. this constraint will be lifted in the future.)
  3144. </p><p>
  3145. Any <code class="filename">searchd</code> instance could serve both as a master
  3146. (which aggregates the results) and a slave (which only does local searching)
  3147. at the same time. This has a number of uses:
  3148. </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>every machine in a cluster could serve as a master which
  3149. searches the whole cluster, and search requests could be balanced between
  3150. masters to achieve a kind of HA (high availability) in case any of the nodes fails;
  3151. </p></li>
  3152. <li class="listitem"><p>
  3153. if running within a single multi-CPU or multi-core machine, there
  3154. would be only 1 searchd instance querying itself as an agent and thus
  3155. utilizing all CPUs/core.
  3156. </p></li>
  3157. </ol></div>
  3158. <p>
  3159. </p><p>
  3160. It is scheduled to implement better HA support which would allow
  3161. to specify which agents mirror each other, do health checks, keep track
  3162. of alive agents, load-balance requests, etc.
  3163. </p></div>
  3164. <div class="sect1" title="5.9.&nbsp;searchd query log formats"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="query-log-format"></a>5.9.&nbsp;<code class="filename">searchd</code> query log formats</h2></div></div></div>
  3165. <p>
  3166. In version 2.0.1-beta and above two query log formats are supported.
  3167. Previous versions only supported a custom plain text format. That format
  3168. is still the default one. However, while it might be more convenient for
  3169. manual monitoring and review, but hard to replay for benchmarks, it only
  3170. logs <span class="emphasis"><em>search</em></span> queries but not the other types
  3171. of requests, does not always contain the complete search query
  3172. data, etc. The default text format is also harder (and sometimes
  3173. impossible) to replay for benchmarking purposes. The new <code class="code">sphinxql</code>
  3174. format alleviates that. It aims to be complete and automatable,
  3175. even though at the cost of brevity and readability.
  3176. </p><div class="sect2" title="5.9.1.&nbsp;Plain log format"><div class="titlepage"><div><div><h3 class="title"><a name="plain-log-format"></a>5.9.1.&nbsp;Plain log format</h3></div></div></div>
  3177. <p>
  3178. By default, <code class="filename">searchd</code> logs all successfully executed search queries
  3179. into a query log file. Here's an example:
  3180. </p><pre class="programlisting">
  3181. [Fri Jun 29 21:17:58 2007] 0.004 sec 0.004 sec [all/0/rel 35254 (0,20)] [lj] test
  3182. [Fri Jun 29 21:20:34 2007] 0.024 sec 0.024 sec [all/0/rel 19886 (0,20) @channel_id] [lj] test
  3183. </pre><p>
  3184. This log format is as follows:
  3185. </p><pre class="programlisting">
  3186. [query-date] real-time wall-time [match-mode/filters-count/sort-mode
  3187. total-matches (offset,limit) @groupby-attr] [index-name] query
  3188. </pre><p>
  3189. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>real-time is a time measured just from start to finish of the query</p></li>
  3190. <li class="listitem"><p>wall-time like real-time but not including waiting for agents and merging result sets time</p></li>
  3191. </ul></div>
  3192. <p>
  3193. Match mode can take one of the following values:
  3194. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>"all" for SPH_MATCH_ALL mode;</p></li>
  3195. <li class="listitem"><p>"any" for SPH_MATCH_ANY mode;</p></li>
  3196. <li class="listitem"><p>"phr" for SPH_MATCH_PHRASE mode;</p></li>
  3197. <li class="listitem"><p>"bool" for SPH_MATCH_BOOLEAN mode;</p></li>
  3198. <li class="listitem"><p>"ext" for SPH_MATCH_EXTENDED mode;</p></li>
  3199. <li class="listitem"><p>"ext2" for SPH_MATCH_EXTENDED2 mode;</p></li>
  3200. <li class="listitem"><p>"scan" if the full scan mode was used, either by being specified with SPH_MATCH_FULLSCAN, or if the query was empty (as documented under <a class="link" href="#matching-modes" title="5.1.&nbsp;Matching modes">Matching Modes</a>)</p></li>
  3201. </ul></div>
  3202. <p>
  3203. Sort mode can take one of the following values:
  3204. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>"rel" for SPH_SORT_RELEVANCE mode;</p></li>
  3205. <li class="listitem"><p>"attr-" for SPH_SORT_ATTR_DESC mode;</p></li>
  3206. <li class="listitem"><p>"attr+" for SPH_SORT_ATTR_ASC mode;</p></li>
  3207. <li class="listitem"><p>"tsegs" for SPH_SORT_TIME_SEGMENTS mode;</p></li>
  3208. <li class="listitem"><p>"ext" for SPH_SORT_EXTENDED mode.</p></li>
  3209. </ul></div>
  3210. <p>
  3211. </p><p>Additionally, if <code class="filename">searchd</code> was started with <code class="option">--iostats</code>, there will be a block of data after where the index(es) searched are listed.</p><p>A query log entry might take the form of:</p><pre class="programlisting">
  3212. [Fri Jun 29 21:17:58 2007] 0.004 sec [all/0/rel 35254 (0,20)] [lj]
  3213. [ios=6 kb=111.1 ms=0.5] test
  3214. </pre><p>
  3215. This additional block is information regarding I/O operations in performing the search:
  3216. the number of file I/O operations carried out, the amount of data in kilobytes read from
  3217. the index files and time spent on I/O operations (although there is a background processing
  3218. component, the bulk of this time is the I/O operation time).
  3219. </p></div>
  3220. <div class="sect2" title="5.9.2.&nbsp;SphinxQL log format"><div class="titlepage"><div><div><h3 class="title"><a name="sphinxql-log-format"></a>5.9.2.&nbsp;SphinxQL log format</h3></div></div></div>
  3221. <p>
  3222. This is a new log format introduced in 2.0.1-beta, with the goals
  3223. begin logging everything and then some, and in a format easy to automate
  3224. (for instance, automatically replay). New format can either be enabled
  3225. via the <a class="link" href="#conf-query-log-format" title="12.4.4.&nbsp;query_log_format">query_log_format</a>
  3226. directive in the configuration file, or switched back and forth
  3227. on the fly with the
  3228. <a class="link" href="#sphinxql-set" title="8.9.&nbsp;SET syntax"><code class="code">SET GLOBAL query_log_format=...</code></a>
  3229. statement via SphinxQL. In the new format, the example from the previous
  3230. section would look as follows. (Wrapped below for readability, but with
  3231. just one query per line in the actual log.)
  3232. </p><pre class="programlisting">
  3233. /* Fri Jun 29 21:17:58.609 2007 2011 conn 2 real 0.004 wall 0.004 found 35254 */
  3234. SELECT * FROM lj WHERE MATCH('test') OPTION ranker=proximity;
  3235. /* Fri Jun 29 21:20:34 2007.555 conn 3 real 0.024 wall 0.024 found 19886 */
  3236. SELECT * FROM lj WHERE MATCH('test') GROUP BY channel_id
  3237. OPTION ranker=proximity;
  3238. </pre><p>
  3239. Note that <span class="bold"><strong>all</strong></span> requests would be logged in this format,
  3240. including those sent via SphinxAPI and SphinxSE, not just those
  3241. sent via SphinxQL. Also note, that this kind of logging works only with plain log
  3242. files and will not work if you use 'syslog' for logging.
  3243. </p><p>
  3244. The features of SphinxQL log format compared to the default text
  3245. one are as follows.
  3246. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>All request types should be logged. (This is still work in progress.)</p></li>
  3247. <li class="listitem"><p>Full statement data will be logged where possible.</p></li>
  3248. <li class="listitem"><p>Errors and warnings are logged.</p></li>
  3249. <li class="listitem"><p>The log should be automatically replayable via SphinxQL.</p></li>
  3250. <li class="listitem"><p>Additional performance counters (currently, per-agent distributed query times) are logged.</p></li>
  3251. </ul></div>
  3252. <p>
  3253. </p><p>
  3254. Use sphinxql:compact_in to shorten your IN() clauses in log if you have
  3255. too much values in it.
  3256. </p><p>
  3257. Every request (including both SphinxAPI and SphinxQL) request
  3258. must result in exactly one log line. All request types, including
  3259. INSERT, CALL SNIPPETS, etc will eventually get logged, though as of
  3260. time of this writing, that is a work in progress). Every log line
  3261. must be a valid SphinxQL statement that reconstructs the full request,
  3262. except if the logged request is too big and needs shortening
  3263. for performance reasons. Additional messages, counters, etc can be
  3264. logged in the comments section after the request.
  3265. </p></div></div>
  3266. <div class="sect1" title="5.10.&nbsp;MySQL protocol support and SphinxQL"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql"></a>5.10.&nbsp;MySQL protocol support and SphinxQL</h2></div></div></div>
  3267. <p>
  3268. Starting with version 0.9.9-rc2, Sphinx searchd daemon supports MySQL binary
  3269. network protocol and can be accessed with regular MySQL API. For instance,
  3270. 'mysql' CLI client program works well. Here's an example of querying
  3271. Sphinx using MySQL client:
  3272. </p><pre class="programlisting">
  3273. $ mysql -P 9306
  3274. Welcome to the MySQL monitor. Commands end with ; or \g.
  3275. Your MySQL connection id is 1
  3276. Server version: 0.9.9-dev (r1734)
  3277. Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
  3278. mysql&gt; SELECT * FROM test1 WHERE MATCH('test')
  3279. -&gt; ORDER BY group_id ASC OPTION ranker=bm25;
  3280. +------+--------+----------+------------+
  3281. | id | weight | group_id | date_added |
  3282. +------+--------+----------+------------+
  3283. | 4 | 1442 | 2 | 1231721236 |
  3284. | 2 | 2421 | 123 | 1231721236 |
  3285. | 1 | 2421 | 456 | 1231721236 |
  3286. +------+--------+----------+------------+
  3287. 3 rows in set (0.00 sec)
  3288. </pre><p>
  3289. </p><p>
  3290. Note that mysqld was not even running on the test machine. Everything was
  3291. handled by searchd itself.
  3292. </p><p>
  3293. The new access method is supported <span class="emphasis"><em>in addition</em></span>
  3294. to native APIs which all still work perfectly well. In fact, both
  3295. access methods can be used at the same time. Also, native API is still
  3296. the default access method. MySQL protocol support needs to be additionally
  3297. configured. This is a matter of 1-line config change, adding a new
  3298. <a class="link" href="#conf-listen" title="12.4.1.&nbsp;listen">listener</a> with mysql41 specified
  3299. as a protocol:
  3300. </p><pre class="programlisting">
  3301. listen = localhost:9306:mysql41
  3302. </pre><p>
  3303. </p><p>
  3304. Just supporting the protocol and not the SQL syntax would be useless
  3305. so Sphinx now also supports a subset of SQL that we dubbed SphinxQL.
  3306. It supports the standard querying all the index types with SELECT,
  3307. modifying RT indexes with INSERT, REPLACE, and DELETE, and much more.
  3308. Full SphinxQL reference is available in <a class="xref" href="#sphinxql-reference" title="Chapter&nbsp;8.&nbsp;SphinxQL reference">Chapter&nbsp;8, <i>SphinxQL reference</i></a>.
  3309. </p></div>
  3310. <div class="sect1" title="5.11.&nbsp;Multi-queries"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="multi-queries"></a>5.11.&nbsp;Multi-queries</h2></div></div></div>
  3311. <p>
  3312. Multi-queries, or query batches, let you send multiple queries to Sphinx
  3313. in one go (more formally, one network request).
  3314. </p><p>
  3315. Two API methods that implement multi-query mechanism are
  3316. <a class="link" href="#api-func-addquery" title="9.6.2.&nbsp;AddQuery">AddQuery()</a> and
  3317. <a class="link" href="#api-func-runqueries" title="9.6.3.&nbsp;RunQueries">RunQueries()</a>.
  3318. You can also run multiple queries with SphinxQL, see
  3319. <a class="xref" href="#sphinxql-multi-queries" title="8.40.&nbsp;Multi-statement queries">Section&nbsp;8.40, &#8220;Multi-statement queries&#8221;</a>.
  3320. (In fact, regular <a class="link" href="#api-func-addquery" title="9.6.2.&nbsp;AddQuery">Query()</a>
  3321. call is internally implemented as a single AddQuery() call immediately
  3322. followed by RunQueries() call.) AddQuery() captures the current state
  3323. of all the query settings set by previous API calls, and memorizes
  3324. the query. RunQueries() actually sends all the memorized queries,
  3325. and returns multiple result sets. There are no restrictions on
  3326. the queries at all, except just a sanity check on a number of queries
  3327. in a single batch (see <a class="xref" href="#conf-max-batch-queries" title="12.4.20.&nbsp;max_batch_queries">Section&nbsp;12.4.20, &#8220;max_batch_queries&#8221;</a>).
  3328. </p><p>
  3329. Why use multi-queries? Generally, it all boils down to performance.
  3330. First, by sending requests to <code class="filename">searchd</code> in a batch
  3331. instead of one by one, you always save a bit by doing less network
  3332. roundtrips. Second, and somewhat more important, sending queries
  3333. in a batch enables <code class="filename">searchd</code> to perform certain
  3334. internal optimizations. As new types of optimizations are being
  3335. added over time, it generally makes sense to pack all the queries
  3336. into batches where possible, so that simply upgrading Sphinx
  3337. to a new version would automatically enable new optimizations.
  3338. In the case when there aren't any possible batch optimizations
  3339. to apply, queries will be processed one by one internally.
  3340. </p><p>
  3341. Why (or rather when) not use multi-queries? Multi-queries requires
  3342. all the queries in a batch to be independent, and sometimes they aren't.
  3343. That is, sometimes query B is based on query A results, and so can only be
  3344. set up after executing query A. For instance, you might want to display
  3345. results from a secondary index if and only if there were no results
  3346. found in a primary index. Or maybe just specify offset into 2nd result set
  3347. based on the amount of matches in the 1st result set. In that case,
  3348. you will have to use separate queries (or separate batches).
  3349. </p><p>
  3350. As of 0.9.10, there are two major optimizations to be aware of:
  3351. common query optimization (available since 0.9.8); and common
  3352. subtree optimization (available since 0.9.10).
  3353. </p><p>
  3354. <span class="bold"><strong>Common query optimization</strong></span> means that <code class="filename">searchd</code>
  3355. will identify all those queries in a batch where only the sorting
  3356. and group-by settings differ, and <span class="emphasis"><em>only perform searching once</em></span>.
  3357. For instance, if a batch consists of 3 queries, all of them are for
  3358. "ipod nano", but 1st query requests top-10 results sorted by price,
  3359. 2nd query groups by vendor ID and requests top-5 vendors sorted by
  3360. rating, and 3rd query requests max price, full-text search for
  3361. "ipod nano" will only be performed once, and its results will be
  3362. reused to build 3 different result sets.
  3363. </p><p>
  3364. So-called <span class="bold"><strong>faceted searching</strong></span> is a particularly important case
  3365. that benefits from this optimization. Indeed, faceted searching
  3366. can be implemented by running a number of queries, one to retrieve
  3367. search results themselves, and a few other ones with same full-text
  3368. query but different group-by settings to retrieve all the required
  3369. groups of results (top-3 authors, top-5 vendors, etc). And as long
  3370. as full-text query and filtering settings stay the same, common
  3371. query optimization will trigger, and greatly improve performance.
  3372. </p><p>
  3373. <span class="bold"><strong>Common subtree optimization</strong></span> is even more interesting.
  3374. It lets <code class="filename">searchd</code> exploit similarities between
  3375. batched full-text queries. It identifies common full-text query parts
  3376. (subtrees) in all queries, and caches them between queries. For instance,
  3377. look at the following query batch:
  3378. </p><pre class="programlisting">
  3379. barack obama president
  3380. barack obama john mccain
  3381. barack obama speech
  3382. </pre><p>
  3383. There's a common two-word part ("barack obama") that can be computed
  3384. only once, then cached and shared across the queries. And common subtree
  3385. optimization does just that. Per-query cache size is strictly controlled
  3386. by <a class="link" href="#conf-subtree-docs-cache" title="12.4.21.&nbsp;subtree_docs_cache">subtree_docs_cache</a>
  3387. and <a class="link" href="#conf-subtree-hits-cache" title="12.4.22.&nbsp;subtree_hits_cache">subtree_hits_cache</a>
  3388. directives (so that caching <span class="emphasis"><em>all</em></span> sixteen gazillions
  3389. of documents that match "i am" does not exhaust the RAM and instantly
  3390. kill your server).
  3391. </p><p>
  3392. Here's a code sample (in PHP) that fire the same query in 3 different
  3393. sorting modes:
  3394. </p><pre class="programlisting">
  3395. require ( "sphinxapi.php" );
  3396. $cl = new SphinxClient ();
  3397. $cl-&gt;SetMatchMode ( SPH_MATCH_EXTENDED );
  3398. $cl-&gt;SetSortMode ( SPH_SORT_RELEVANCE );
  3399. $cl-&gt;AddQuery ( "the", "lj" );
  3400. $cl-&gt;SetSortMode ( SPH_SORT_EXTENDED, "published desc" );
  3401. $cl-&gt;AddQuery ( "the", "lj" );
  3402. $cl-&gt;SetSortMode ( SPH_SORT_EXTENDED, "published asc" );
  3403. $cl-&gt;AddQuery ( "the", "lj" );
  3404. $res = $cl-&gt;RunQueries();
  3405. </pre><p>
  3406. </p><p>
  3407. How to tell whether the queries in the batch were actually optimized?
  3408. If they were, respective query log will have a "multiplier" field that
  3409. specifies how many queries were processed together:
  3410. </p><pre class="programlisting">
  3411. [Sun Jul 12 15:18:17.000 2009] 0.040 sec x3 [ext/0/rel 747541 (0,20)] [lj] the
  3412. [Sun Jul 12 15:18:17.000 2009] 0.040 sec x3 [ext/0/ext 747541 (0,20)] [lj] the
  3413. [Sun Jul 12 15:18:17.000 2009] 0.040 sec x3 [ext/0/ext 747541 (0,20)] [lj] the
  3414. </pre><p>
  3415. Note the "x3" field. It means that this query was optimized and
  3416. processed in a sub-batch of 3 queries. For reference, this is how
  3417. the regular log would look like if the queries were not batched:
  3418. </p><pre class="programlisting">
  3419. [Sun Jul 12 15:18:17.062 2009] 0.059 sec [ext/0/rel 747541 (0,20)] [lj] the
  3420. [Sun Jul 12 15:18:17.156 2009] 0.091 sec [ext/0/ext 747541 (0,20)] [lj] the
  3421. [Sun Jul 12 15:18:17.250 2009] 0.092 sec [ext/0/ext 747541 (0,20)] [lj] the
  3422. </pre><p>
  3423. Note how per-query time in multi-query case was improved by a factor
  3424. of 1.5x to 2.3x, depending on a particular sorting mode. In fact, for both
  3425. common query and common subtree optimizations, there were reports of 3x and
  3426. even more improvements, and that's from production instances, not just
  3427. synthetic tests.
  3428. </p></div>
  3429. <div class="sect1" title="5.12.&nbsp;Collations"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="collations"></a>5.12.&nbsp;Collations</h2></div></div></div>
  3430. <p>
  3431. Introduced to Sphinx in version 2.0.1-beta to supplement string sorting,
  3432. collations essentially affect the string attribute comparisons. They specify
  3433. both the character set encoding and the strategy that Sphinx uses to compare
  3434. strings when doing ORDER BY or GROUP BY with a string attribute involved.
  3435. </p><p>
  3436. String attributes are stored as is when indexing, and no character set
  3437. or language information is attached to them. That's okay as long as Sphinx
  3438. only needs to store and return the strings to the calling application verbatim.
  3439. But when you ask Sphinx to sort by a string value, that request immediately
  3440. becomes quite ambiguous.
  3441. </p><p>
  3442. First, single-byte (ASCII, or ISO-8859-1, or Windows-1251) strings
  3443. need to be processed differently that the UTF-8 ones that may encode
  3444. every character with a variable number of bytes. So we need to know
  3445. what is the character set type to interpret the raw bytes as meaningful
  3446. characters properly.
  3447. </p><p>
  3448. Second, we additionally need to know the language-specific
  3449. string sorting rules. For instance, when sorting according to US rules
  3450. in en_US locale, the accented character 'ï' (small letter i with diaeresis)
  3451. should be placed somewhere after 'z'. However, when sorting with French rules
  3452. and fr_FR locale in mind, it should be placed between 'i' and 'j'. And some
  3453. other set of rules might choose to ignore accents at all, allowing 'ï'
  3454. and 'i' to be mixed arbitrarily.
  3455. </p><p>
  3456. Third, but not least, we might need case-sensitive sorting in some
  3457. scenarios and case-insensitive sorting in some others.
  3458. </p><p>
  3459. Collations combine all of the above: the character set, the language rules,
  3460. and the case sensitivity. Sphinx currently provides the following four
  3461. collations.
  3462. </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p><code class="option">libc_ci</code></p></li>
  3463. <li class="listitem"><p><code class="option">libc_cs</code></p></li>
  3464. <li class="listitem"><p><code class="option">utf8_general_ci</code></p></li>
  3465. <li class="listitem"><p><code class="option">binary</code></p></li>
  3466. </ol></div>
  3467. <p>
  3468. </p><p>
  3469. The first two collations rely on several standard C library (libc) calls
  3470. and can thus support any locale that is installed on your system. They provide
  3471. case-insensitive (_ci) and case-sensitive (_cs) comparisons respectively.
  3472. By default they will use C locale, effectively resorting to bytewise
  3473. comparisons. To change that, you need to specify a different available
  3474. locale using <a class="link" href="#conf-collation-libc-locale" title="12.4.30.&nbsp;collation_libc_locale">collation_libc_locale</a>
  3475. directive. The list of locales available on your system can usually be obtained
  3476. with the <code class="filename">locale</code> command:
  3477. </p><pre class="programlisting">
  3478. $ locale -a
  3479. C
  3480. en_AG
  3481. en_AU.utf8
  3482. en_BW.utf8
  3483. en_CA.utf8
  3484. en_DK.utf8
  3485. en_GB.utf8
  3486. en_HK.utf8
  3487. en_IE.utf8
  3488. en_IN
  3489. en_NG
  3490. en_NZ.utf8
  3491. en_PH.utf8
  3492. en_SG.utf8
  3493. en_US.utf8
  3494. en_ZA.utf8
  3495. en_ZW.utf8
  3496. es_ES
  3497. fr_FR
  3498. POSIX
  3499. ru_RU.utf8
  3500. ru_UA.utf8
  3501. </pre><p>
  3502. </p><p>
  3503. The specific list of the system locales may vary. Consult your OS documentation
  3504. to install additional needed locales.
  3505. </p><p>
  3506. <code class="option">utf8_general_ci</code> and <code class="option">binary</code> locales are
  3507. built-in into Sphinx. The first one is a generic collation for UTF-8 data
  3508. (without any so-called language tailoring); it should behave similar to
  3509. <code class="option">utf8_general_ci</code> collation in MySQL. The second one
  3510. is a simple bytewise comparison.
  3511. </p><p>
  3512. Collation can be overridden via SphinxQL on a per-session basis using
  3513. <code class="code">SET collation_connection</code> statement. All subsequent SphinxQL
  3514. queries will use this collation. SphinxAPI and SphinxSE queries will use
  3515. the server default collation, as specified in
  3516. <a class="link" href="#conf-collation-server" title="12.4.29.&nbsp;collation_server">collation_server</a> configuration
  3517. directive. Sphinx currently defaults to <code class="option">libc_ci</code> collation.
  3518. </p><p>
  3519. Collations should affect all string attribute comparisons, including
  3520. those within ORDER BY and GROUP BY, so differently ordered or grouped results
  3521. can be returned depending on the collation chosen.
  3522. </p></div></div>
  3523. <div class="chapter" title="Chapter&nbsp;6.&nbsp;Extending Sphinx"><div class="titlepage"><div><div><h2 class="title"><a name="extending-sphinx"></a>Chapter&nbsp;6.&nbsp;Extending Sphinx</h2></div></div></div>
  3524. <div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#sphinx-udfs">6.1. Sphinx UDFs (User Defined Functions)</a></span></dt>
  3525. <dt><span class="sect1"><a href="#sphinx-plugins">6.2. Sphinx plugins</a></span></dt>
  3526. <dt><span class="sect1"><a href="#ranker-plugins">6.3. Ranker plugins</a></span></dt>
  3527. </dl></div>
  3528. <div class="sect1" title="6.1.&nbsp;Sphinx UDFs (User Defined Functions)"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinx-udfs"></a>6.1.&nbsp;Sphinx UDFs (User Defined Functions)</h2></div></div></div>
  3529. <p>
  3530. Starting with 2.0.1-beta, our expression engine can be extended with
  3531. user defined functions, or UDFs for short, like this:
  3532. </p><pre class="programlisting">
  3533. SELECT id, attr1, myudf(attr2, attr3+attr4) ...
  3534. </pre><p>
  3535. You can load and unload UDFs dynamically into <code class="filename">searchd</code>
  3536. without having to restart the daemon, and used them in expressions when
  3537. searching, ranking, etc. Quick summary of the UDF features is as follows.
  3538. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>UDFs can take integer (both 32-bit and 64-bit), float,
  3539. string, MVA, or PACKEDFACTORS() arguments.</p></li>
  3540. <li class="listitem"><p>UDFs can return integer, float, or string values.</p></li>
  3541. <li class="listitem"><p>UDFs can check the argument number, types, and names
  3542. during the query setup phase, and raise errors.</p></li>
  3543. <li class="listitem"><p>Aggregation UDFs are not yet supported (but might be
  3544. in the future).</p></li>
  3545. </ul></div>
  3546. <p>
  3547. UDFs have a wide variety of uses, for instance:
  3548. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>adding custom mathematical or string functions;</p></li>
  3549. <li class="listitem"><p>accessing the database or files from within Sphinx;</p></li>
  3550. <li class="listitem"><p>implementing complex ranking functions.</p></li>
  3551. </ul></div>
  3552. <p>
  3553. </p><p>
  3554. UDFs reside in the external dynamic libraries (.so files on UNIX and .dll
  3555. on Windows systems). Library files need to reside in a trusted folder
  3556. specified by <a class="link" href="#conf-plugin-dir" title="12.4.31.&nbsp;plugin_dir">plugin_dir</a> directive,
  3557. for obvious security reasons: securing a single folder is easy; letting
  3558. anyone install arbitrary code into <code class="filename">searchd</code> is a risk.
  3559. You can load and unload them dynamically into searchd
  3560. with <a class="link" href="#sphinxql-create-function" title="8.18.&nbsp;CREATE FUNCTION syntax">CREATE FUNCTION</a> and
  3561. <a class="link" href="#sphinxql-drop-function" title="8.19.&nbsp;DROP FUNCTION syntax">DROP FUNCTION</a> SphinxQL statements
  3562. respectively. Sphinx keeps track of the currently loaded functions, that is,
  3563. every time you create or drop an UDF, <code class="filename">searchd</code> writes
  3564. its state to the <a class="link" href="#conf-sphinxql-state" title="12.4.38.&nbsp;sphinxql_state">sphinxql_state</a> file
  3565. as a plain good old SQL script.
  3566. </p><p>
  3567. Once you successfully load an UDF, you can use it in your SELECT or other
  3568. statements just as well as any of the builtin functions:
  3569. </p><pre class="programlisting">
  3570. SELECT id, MYCUSTOMFUNC(groupid, authorname), ... FROM myindex
  3571. </pre><p>
  3572. </p><p>
  3573. UDFs are completely supported in <a class="link" href="#conf-workers" title="12.4.23.&nbsp;workers">workers=threads</a>
  3574. mode only. They are partially supported in <code class="code">workers=prefork</code> mode too:
  3575. namely, CREATEs from the <code class="code">sphinxql_state</code> startup script will work and
  3576. those UDFs will be accessible. However, DROPs will not be available. UDFs are not
  3577. supported in <code class="code">workers=fork</code> mode.
  3578. </p><p>
  3579. Multiple UDFs (and other plugins) may reside in a single library. That library
  3580. will only be loaded once. It gets automatically unloaded once all the UDFs and
  3581. plugins from it are dropped.
  3582. </p><p>
  3583. In theory you can write an UDF in any language as long as its compiler
  3584. is able to import standard C header, and emit standard dynamic libraries with
  3585. properly exported functions. Of course, the path of least resistance is to write
  3586. in either C++ or plain C. We provide an example UDF library written in plain C
  3587. and implementing several functions (demonstrating a few different techniques)
  3588. along with our source code, see
  3589. <a class="ulink" href="http://code.google.com/p/sphinxsearch/source/browse/trunk/src/udfexample.c" target="_top">src/udfexample.c</a>.
  3590. That example includes
  3591. <a class="ulink" href="http://code.google.com/p/sphinxsearch/source/browse/trunk/src/sphinxudf.h" target="_top">src/sphinxudf.h</a>
  3592. header file definitions of a few UDF related structures and types. For most
  3593. UDFs and plugins, a mere <code class="code">#include "sphinxudf.h"</code>, like in the example,
  3594. should be completely sufficient, too. However, if you're writing a ranking function and
  3595. need to access the ranking signals (factors) data from within the UDF, you will
  3596. also need to compile and link with <code class="filename">src/sphinxudf.c</code> (also
  3597. available in our source code), because the <span class="emphasis"><em>implementations</em></span>
  3598. of the fuctions that let you access the signal data from within the UDF reside
  3599. in that file.
  3600. </p><p>
  3601. Both <code class="filename">sphinxudf.h</code> header and <code class="filename">sphinxudf.c</code>
  3602. are standalone. So you can copy around those files only; they do not depend
  3603. on any other bits of Sphinx source code.
  3604. </p><p>
  3605. Within your UDF, you <span class="bold"><strong>must</strong></span> implement and export only a couple functions,
  3606. literally. First, for UDF interface version control, you <span class="bold"><strong>must</strong></span> define
  3607. a function <code class="code">int LIBRARYNAME_ver()</code>, where LIBRARYNAME is the name
  3608. of your library file, and you must return <code class="code">SPH_UDF_VERSION</code> (a value
  3609. defined in <code class="filename">sphinxudf.h</code>) from it. Here's an example.
  3610. </p><pre class="programlisting">
  3611. #include &lt;sphinxudf.h&gt;
  3612. // our library will be called udfexample.so, thus, so it must define
  3613. // a version function named udfexample_ver()
  3614. int udfexample_ver()
  3615. {
  3616. return SPH_UDF_VERSION;
  3617. }
  3618. </pre><p>
  3619. That protects you from accidentally loading a library with a mismatching
  3620. UDF interface version into a newer or older <code class="filename">searchd</code>.
  3621. Second, yout <span class="bold"><strong>must</strong></span> implement the actual function, too.
  3622. <code class="code">
  3623. sphinx_int64_t testfunc ( SPH_UDF_INIT * init, SPH_UDF_ARGS * args,
  3624. char * error_flag )
  3625. {
  3626. return 123;
  3627. }
  3628. </code>
  3629. </p><p>
  3630. UDF function names in SphinxQL are case insensitive. However, the
  3631. respective C function names are not, they need to be all <span class="bold"><strong>lower-case</strong></span>,
  3632. or the UDF will not load. More importantly, it is vital that a) the calling
  3633. convention is C (aka __cdecl), b) arguments list matches the plugin system
  3634. expectations exactly, and c) the return type matches the one you specify in
  3635. <code class="code">CREATE FUNCTION</code>. Unfortunately, there is no (easy) way for us
  3636. to check for those mistakes when loading the function, and they could crash
  3637. the server and/or result in unexpected results. Last but not least,
  3638. all the C functions you implement need to be thread-safe.
  3639. </p><p>
  3640. The first argument, a pointer to SPH_UDF_INIT structure, is essentially
  3641. a pointer to our function state. It is option. In the example just above
  3642. the function is stateless, it simply returns 123 every time it gets called.
  3643. So we do not have to define an initialization function, and we can simply
  3644. ignore that argument.
  3645. </p><p>
  3646. The second argument, a pointer to SPH_UDF_ARGS, is the most important one.
  3647. All the actual call arguments are passed to your UDF via this structure;
  3648. it contians the call argument count, names, types, etc. So whether your
  3649. function gets called like <code class="code">SELECT id, testfunc(1)</code> or like
  3650. <code class="code">SELECT id, testfunc('abc', 1000*id+gid, WEIGHT())</code> or anyhow
  3651. else, it will receive the very same SPH_UDF_ARGS structure in all of these
  3652. cases. However, the data passed in the <code class="code">args</code> structure will be
  3653. different. In the first example <code class="code">args-&gt;arg_count</code> will be set to 1,
  3654. in the second example it will be set to 3, <code class="code">args-&gt;arg_types</code> array
  3655. will contain different type data, and so on.
  3656. </p><p>
  3657. Finally, the third argument is an error flag. UDF can raise it to indicate
  3658. that some kinda of an internal error happened, the UDF can not continue, and
  3659. the query should terminate early. You should <span class="bold"><strong>not</strong></span> use this for argument
  3660. type checks or for any other error reporting that is likely to happen during
  3661. normal use. This flag is designed to report sudden critical runtime errors,
  3662. such as running out of memory.
  3663. </p><p>
  3664. If we wanted to, say, allocate temporary storage for our function to use,
  3665. or check upfront whether the arguments are of the supported types, then
  3666. we would need to add two more functions, with UDF initialization and deinitialization,
  3667. respectively.
  3668. </p><pre class="programlisting">
  3669. int testfunc_init ( SPH_UDF_INIT * init, SPH_UDF_ARGS * args,
  3670. char * error_message )
  3671. {
  3672. // allocate and initialize a little bit of temporary storage
  3673. init-&gt;func_data = malloc ( sizeof(int) );
  3674. *(int*)init-&gt;func_data = 123;
  3675. // return a success code
  3676. return 0;
  3677. }
  3678. void testfunc_deinit ( SPH_UDF_INIT * init )
  3679. {
  3680. // free up our temporary storage
  3681. free ( init-&gt;func_data );
  3682. }
  3683. </pre><p>
  3684. Note how <code class="code">testfunc_init()</code> also receives the call arguments
  3685. structure. By the time it is called it does not receive any actual values,
  3686. so the <code class="code">args-&gt;arg_values</code> will be NULL. But the argument
  3687. names and types are known and will be passed. You can check them in
  3688. the initialization function and return an error if they are of an
  3689. unsupported type.
  3690. </p><p>
  3691. UDFs can receive arguments of pretty much any valid internal Sphinx type.
  3692. Refer to <code class="code">sphinx_udf_argtype</code> enumeration in <code class="filename">sphinxudf.h</code>
  3693. for a full list. Most of the types map straightforwardly to the respective C types.
  3694. The most notable exception is the SPH_UDF_TYPE_FACTORS argument type.
  3695. You get that type by calling your UDF with a
  3696. <a class="link" href="#expr-func-packedfactors">PACKEDFACTOR()</a> argument.
  3697. It's data is a binary blob in a certain internal format, and to extract
  3698. individual ranking signals from that blob, you need to use either of the
  3699. two <code class="code">sphinx_factors_XXX()</code> or <code class="code">sphinx_get_YYY_factor()</code>
  3700. families of functions. The first family consists of just 3 functions,
  3701. <code class="code">sphinx_factors_init()</code> that initializes the unpacked
  3702. SPH_UDF_FACTORS structure, <code class="code">sphinx_factors_unpack()</code> that
  3703. unpacks a binary blob into it, and <code class="code">sphinx_factors_deinit()</code>
  3704. that cleans up an deallocates the SPH_UDF_FACTORS. So you need to call
  3705. init() and unpack(), then you can use the SPH_UDF_FACTORS fields, and
  3706. then you need to cleanup with deinit(). That is simple, but results
  3707. in a bunch of memory allocations per each processed document, and might
  3708. be slow. The other interface, consisting of a bunch of
  3709. <code class="code">sphinx_get_YYY_factor()</code> functions, is a little more wordy
  3710. to use, but accesses the blob data directly and guarantees that there
  3711. will be zero allocations. So for top-notch ranking UDF performance,
  3712. you want to use that one.
  3713. </p><p>
  3714. As for the return types, UDFs can currently return a signle INT, BIGINT,
  3715. FLOAT, or STRING value. The C function return type should be sphinx_int64_t,
  3716. sphinx_int64_t, double, or char* respectively. In the last case you <span class="bold"><strong>must</strong></span>
  3717. use <code class="code">args-&gt;fn_malloc</code> function to allocate the returned
  3718. string values. Internally in your UDF you can use whatever you want,
  3719. so the <code class="code">testfunc_init()</code> example above is correct code
  3720. even though it uses malloc() directly: you manage that pointer yourself,
  3721. it gets freed up using a matching free() call, and all is well. However,
  3722. the returned strings values are managed by Sphinx and we have our own
  3723. allocator, so for the return values specifically, you need to use it too.
  3724. </p><p>
  3725. Depending on how your UDFs are used in the query, the main function
  3726. call (<code class="code">testfunc()</code> in our example) might be called in a rather
  3727. different volume and order. Specifically,
  3728. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>UDFs referenced in WHERE, ORDER BY, or GROUP BY clauses
  3729. must and will be evaluated for every matched document. They will be called
  3730. in the natural matching order.
  3731. </p></li>
  3732. <li class="listitem"><p>without subselects, UDFs that can be evaluated at the very
  3733. last stage over the final result set will be evaluated that way, but before
  3734. applying the LIMIT clause. They will be called in the result set order.
  3735. </p></li>
  3736. <li class="listitem"><p>with subselects, such UDFs will also be evaluated after
  3737. applying the inner LIMIT clause.
  3738. </p></li>
  3739. </ul></div>
  3740. <p>
  3741. </p><p>
  3742. The calling sequence of the other functions is fixed, though. Namely,
  3743. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="code">testfunc_init()</code> is called once when initializing
  3744. the query. It can return a non-zero code to indicate a failure; in that case
  3745. query will be terminated, and the error message from the <code class="code">error_message</code>
  3746. buffer will be returned.</p></li>
  3747. <li class="listitem"><p><code class="code">testfunc()</code> is called for every eligible row
  3748. (see above), whenever Sphinx needs to compute the UDF value. It can also
  3749. indicate an (internal) failure error by writing a non-zero byte value to
  3750. <code class="code">error_flag</code>. In that case, it is guaranteed that will no more be
  3751. called for subsequent rows, and a default return value of 0 will be substituted.
  3752. Sphinx might or might not choose to terminate such queries early, neither
  3753. behavior is currently guaranteed.
  3754. </p></li>
  3755. <li class="listitem"><p><code class="code">testfunc_deinit()</code> is called once when the query
  3756. processing (in a given index shard) ends.</p></li>
  3757. </ul></div>
  3758. <p>
  3759. </p><p>
  3760. As of 2.2.2-beta, we do not yet support aggregation functions. In other words,
  3761. your UDFs will be called for just a single document at a time and are expected
  3762. to return some value for that document. Writing a function that can compute an
  3763. aggregate value like AVG() over the entire group of documents that share the same
  3764. GROUP BY key is not yet possible. However, you can use UDFs within the builtin
  3765. aggregate functions: that is, even though MYCUSTOMAVG() is not supported yet,
  3766. AVG(MYCUSTOMFUNC()) should work alright!
  3767. </p><p>
  3768. UDFs are local. In order to use them on a cluster, you have to put the same
  3769. library on all its nodes and run CREATEs on all the nodes too. This might change
  3770. in the future versions.
  3771. </p></div>
  3772. <div class="sect1" title="6.2.&nbsp;Sphinx plugins"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinx-plugins"></a>6.2.&nbsp;Sphinx plugins</h2></div></div></div>
  3773. <p>
  3774. Starting with version 2.2.2-beta, we generalized our dynamic plugin
  3775. system, and added a few more types of dynamic plugins. Here's the complete
  3776. plugin type list.
  3777. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>UDF plugins;</p></li>
  3778. <li class="listitem"><p>ranker plugins;</p></li>
  3779. <li class="listitem"><p>indexing-time token filter plugins;</p></li>
  3780. <li class="listitem"><p>query-time token filter plugins.</p></li>
  3781. </ul></div>
  3782. <p>
  3783. This section discusses writing and managing plugins in general;
  3784. things specific to writing this or that type of a plugin are then
  3785. discussed in their respective subsections.
  3786. </p><p>
  3787. So, how do you write and use a plugin? Three-line crash course
  3788. goes as follows:
  3789. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>create a dynamic library (either .so or.dll),
  3790. most likely in C or C++;</p></li>
  3791. <li class="listitem"><p>load that plugin into searchd using
  3792. <a class="link" href="#sphinxql-create-plugin" title="8.36.&nbsp;CREATE PLUGIN syntax">CREATE PLUGIN</a>;
  3793. </p></li>
  3794. <li class="listitem"><p>invoke it using the plugin specific calls
  3795. (typically using this or that OPTION).
  3796. </p></li>
  3797. </ul></div>
  3798. <p>
  3799. Note that while UDFs are first-class plugins they are nevertheless
  3800. installed using a separate
  3801. <a class="link" href="#sphinxql-create-function" title="8.18.&nbsp;CREATE FUNCTION syntax">CREATE FUNCTION</a>
  3802. statement. It lets you specify the return type neatly so there was
  3803. especially little reason to ruin backwards compatibility <span class="emphasis"><em>and</em></span>
  3804. change the syntax.
  3805. </p><p>
  3806. Dynamic plugins are supported in <a class="link" href="#conf-workers" title="12.4.23.&nbsp;workers">workers=threads</a>
  3807. mode only. Multiple plugins (and/or UDFs) may reside in a single library file.
  3808. So you might choose to either put all your project-specific plugins in a single
  3809. common uber-library; or you might choose to have a separate library for every
  3810. UDF and plugin; that is up to you.
  3811. </p><p>
  3812. Just as with UDFs, you want to include <code class="filename">src/sphinxudf.h</code>
  3813. header file. At the very least, you will need the SPH_UDF_VERSION
  3814. constant to implement a proper version function. Depending on the specific
  3815. plugin type, you might or might not need to link your plugin with
  3816. <code class="filename">src/sphinxudf.c</code>. However, as of 2.2.2-beta all
  3817. the functions implemented in <code class="filename">sphinxudf.c</code> are about
  3818. unpacking the PACKEDFACTORS() blob, and no plugin types are exposed to that
  3819. kind of data. So currently, you would never need to link with the C-file,
  3820. just the header would be sufficient. (In fact, if you copy over the
  3821. UDF version number, then for some of the plugin types you would not
  3822. even need the header file.)
  3823. </p><p>
  3824. Formally, plugins are just sets of C functions that follow a certain
  3825. naming parttern. You are typically required to define just one key function
  3826. that does the most important work, but you may define a bunch of other
  3827. functions, too. For example, to implement a ranker called "myrank",
  3828. you must define <code class="code">myrank_finalize()</code> function that actually returns
  3829. the rank value, however, you might also define <code class="code">myrank_init()</code>,
  3830. <code class="code">myrank_update()</code>, and <code class="code">myrank_deinit()</code> functions.
  3831. Specific sets of well-known suffixes and the call arguments do differ
  3832. based on the plugin type, but _init() and _deinit() are generic, every
  3833. plugin has those. Protip: for a quick reference on the known suffixes and
  3834. their argument types, refer to <code class="filename">sphinxplugin.h</code>,
  3835. we define the call prototoypes in the very beginning of that file.
  3836. </p><p>
  3837. Despite having the public interface defined in ye good olde good pure C,
  3838. our plugins essentially follow the <span class="emphasis"><em>object-oriented model</em></span>.
  3839. Indeed, every <code class="code">_init()</code> function receives a <code class="code">void ** userdata</code>
  3840. out-parameter. And the pointer value that you store at <code class="code">(*userdata)</code>
  3841. location is then be passed as a 1st argument to all the other plugin functions.
  3842. So you can think of a plugin as <span class="emphasis"><em>class</em></span> that gets instantiated
  3843. every time an object of that class is needed to handle a request: the <code class="code">userdata</code>
  3844. pointer would be its <code class="code">this</code> pointer; the functions would be its methods,
  3845. and the <code class="code">_init()</code> and <code class="code">_deinit()</code> functions would be
  3846. the constructor and destructor respectively.
  3847. </p><p>
  3848. Why this (minor) OOP-in-C complication? Well, plugins run in a multi-threaded
  3849. environment, and some of them have to be stateful. You can't keep that state in
  3850. a global variable in your plugin. So we have to pass around a userdata parameter
  3851. anyway to let you keep that state. And that naturally brings us to the OOP model.
  3852. And if you've got a simple, stateless plugin, the interface lets you omit the
  3853. <code class="code">_init()</code> and <code class="code">_deinit()</code> and whatever other functions
  3854. just as well.
  3855. </p><p>
  3856. To summarize, here goes the simplest complete ranker plugin, in just
  3857. 3 lines of C code.
  3858. </p><pre class="programlisting">
  3859. // gcc -fPIC -shared -o myrank.so myrank.c
  3860. #include "sphinxudf.h"
  3861. int myrank_ver() { return SPH_UDF_VERSION; }
  3862. int myrank_finalize(void *u, int w) { return 123; }
  3863. </pre><p>
  3864. And this is how you use it:
  3865. </p><pre class="programlisting">
  3866. mysql&gt; CREATE PLUGIN myrank TYPE 'ranker' SONAME 'myrank.dll';
  3867. Query OK, 0 rows affected (0.00 sec)
  3868. mysql&gt; SELECT id, weight() FROM test1 WHERE MATCH('test')
  3869. -&gt; OPTION ranker=myrank('');
  3870. +------+----------+
  3871. | id | weight() |
  3872. +------+----------+
  3873. | 1 | 123 |
  3874. | 2 | 123 |
  3875. +------+----------+
  3876. 2 rows in set (0.01 sec)
  3877. </pre><p>
  3878. </p></div>
  3879. <div class="sect1" title="6.3.&nbsp;Ranker plugins"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ranker-plugins"></a>6.3.&nbsp;Ranker plugins</h2></div></div></div>
  3880. <p>
  3881. Ranker plugins let you implement a custom ranker that receives
  3882. all the occurrences of the keywords matched in the document, and
  3883. computes a WEIGHT() value. They can be called as follows:
  3884. </p><pre class="programlisting">
  3885. SELECT id, attr1 FROM test WHERE match('hello')
  3886. OPTION ranker=myranker('option1=1');
  3887. </pre><p>
  3888. </p><p>
  3889. The call workflow is as follows:
  3890. </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><code class="code">XXX_init()</code> gets called once per query
  3891. per index, in the very beginning. A few query-wide options are
  3892. passed to it through a <code class="code">SPH_RANKER_INIT</code> structure,
  3893. including the user options strings (in the example just above,
  3894. "option1=1" is that string).</li>
  3895. <li class="listitem"><code class="code">XXX_update()</code> gets called multiple times per
  3896. matched document, with every matched keyword occurrence passed as its
  3897. parameter, a <code class="code">SPH_RANKER_HIT</code> structure. The occurrences
  3898. within each document are guaranteed to be passed in the order of
  3899. ascending <code class="code">hit-&gt;hit_pos</code> values.</li>
  3900. <li class="listitem"><code class="code">XXX_finalize()</code> gets called once per matched
  3901. document, once there are no more keyword occurrences. It must return
  3902. the WEIGHT() value. This is the only mandatory function.</li>
  3903. <li class="listitem"><code class="code">XXX_deinit()</code> gets called once per query,
  3904. in the very end.</li>
  3905. </ol></div>
  3906. <p>
  3907. </p></div></div>
  3908. <div class="chapter" title="Chapter&nbsp;7.&nbsp;Command line tools reference"><div class="titlepage"><div><div><h2 class="title"><a name="command-line-tools"></a>Chapter&nbsp;7.&nbsp;Command line tools reference</h2></div></div></div>
  3909. <div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#ref-indexer">7.1. <code class="filename">indexer</code> command reference</a></span></dt>
  3910. <dt><span class="sect1"><a href="#ref-searchd">7.2. <code class="filename">searchd</code> command reference</a></span></dt>
  3911. <dt><span class="sect1"><a href="#ref-spelldump">7.3. <code class="filename">spelldump</code> command reference</a></span></dt>
  3912. <dt><span class="sect1"><a href="#ref-indextool">7.4. <code class="filename">indextool</code> command reference</a></span></dt>
  3913. <dt><span class="sect1"><a href="#ref-wordbreaker">7.5. <code class="filename">wordbreaker</code> command reference</a></span></dt>
  3914. </dl></div>
  3915. <p>As mentioned elsewhere, Sphinx is not a single program called 'sphinx',
  3916. but a collection of 4 separate programs which collectively form Sphinx. This section
  3917. covers these tools and how to use them.</p><div class="sect1" title="7.1.&nbsp;indexer command reference"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ref-indexer"></a>7.1.&nbsp;<code class="filename">indexer</code> command reference</h2></div></div></div>
  3918. <p><code class="filename">indexer</code> is the first of the two principal tools
  3919. as part of Sphinx. Invoked from either the command line directly, or as part
  3920. of a larger script, <code class="filename">indexer</code> is solely responsible
  3921. for gathering the data that will be searchable.</p><p>The calling syntax for <code class="filename">indexer</code> is as follows:</p><pre class="programlisting">
  3922. indexer [OPTIONS] [indexname1 [indexname2 [...]]]
  3923. </pre><p>Essentially you would list the different possible indexes (that you would later
  3924. make available to search) in <code class="filename">sphinx.conf</code>, so when calling
  3925. <code class="filename">indexer</code>, as a minimum you need to be telling it what index
  3926. (or indexes) you want to index.</p><p>If <code class="filename">sphinx.conf</code> contained details on 2 indexes,
  3927. <code class="filename">mybigindex</code> and <code class="filename">mysmallindex</code>,
  3928. you could do the following:</p><pre class="programlisting">
  3929. $ indexer mybigindex
  3930. $ indexer mysmallindex mybigindex
  3931. </pre><p>As part of the configuration file, <code class="filename">sphinx.conf</code>, you specify
  3932. one or more indexes for your data. You might call <code class="filename">indexer</code> to reindex
  3933. one of them, ad-hoc, or you can tell it to process all indexes - you are not limited
  3934. to calling just one, or all at once, you can always pick some combination
  3935. of the available indexes.</p><p>The majority of the options for <code class="filename">indexer</code> are given
  3936. in the configuration file, however there are some options you might need to specify
  3937. on the command line as well, as they can affect how the indexing operation is performed.
  3938. These options are:
  3939. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="option">--config &lt;file&gt;</code> (<code class="option">-c &lt;file&gt;</code> for short)
  3940. tells <code class="filename">indexer</code> to use the given file as its configuration. Normally,
  3941. it will look for <code class="filename">sphinx.conf</code> in the installation directory
  3942. (e.g. <code class="filename">/usr/local/sphinx/etc/sphinx.conf</code> if installed into
  3943. <code class="filename">/usr/local/sphinx</code>), followed by the current directory you are
  3944. in when calling <code class="filename">indexer</code> from the shell. This is most of use
  3945. in shared environments where the binary files are installed somewhere like
  3946. <code class="filename">/usr/local/sphinx/</code> but you want to provide users with
  3947. the ability to make their own custom Sphinx set-ups, or if you want to run
  3948. multiple instances on a single server. In cases like those you could allow them
  3949. to create their own <code class="filename">sphinx.conf</code> files and pass them to
  3950. <code class="filename">indexer</code> with this option. For example:
  3951. </p><pre class="programlisting">
  3952. $ indexer --config /home/myuser/sphinx.conf myindex
  3953. </pre><p>
  3954. </p></li>
  3955. <li class="listitem"><p><code class="option">--all</code> tells <code class="filename">indexer</code> to update
  3956. every index listed in <code class="filename">sphinx.conf</code>, instead of listing individual indexes.
  3957. This would be useful in small configurations, or <code class="filename">cron</code>-type or maintenance
  3958. jobs where the entire index set will get rebuilt each day, or week, or whatever period is best.
  3959. Example usage:
  3960. </p><pre class="programlisting">
  3961. $ indexer --config /home/myuser/sphinx.conf --all
  3962. </pre><p>
  3963. </p></li>
  3964. <li class="listitem"><p><code class="option">--rotate</code> is used for rotating indexes. Unless you have the situation
  3965. where you can take the search function offline without troubling users, you will almost certainly
  3966. need to keep search running whilst indexing new documents. <code class="option">--rotate</code> creates
  3967. a second index, parallel to the first (in the same place, simply including <code class="filename">.new</code>
  3968. in the filenames). Once complete, <code class="filename">indexer</code> notifies <code class="filename">searchd</code>
  3969. via sending the <code class="option">SIGHUP</code> signal, and <code class="filename">searchd</code> will attempt
  3970. to rename the indexes (renaming the existing ones to include <code class="filename">.old</code>
  3971. and renaming the <code class="filename">.new</code> to replace them), and then start serving
  3972. from the newer files. Depending on the setting of
  3973. <a class="link" href="#conf-seamless-rotate" title="12.4.9.&nbsp;seamless_rotate">seamless_rotate</a>, there may be a slight delay
  3974. in being able to search the newer indexes. Example usage:
  3975. </p><pre class="programlisting">
  3976. $ indexer --rotate --all
  3977. </pre><p>
  3978. </p></li>
  3979. <li class="listitem"><p><code class="option">--quiet</code> tells <code class="filename">indexer</code> not to output anything,
  3980. unless there is an error. Again, most used for <code class="filename">cron</code>-type, or other script
  3981. jobs where the output is irrelevant or unnecessary, except in the event of some kind of error.
  3982. Example usage:
  3983. </p><pre class="programlisting">
  3984. $ indexer --rotate --all --quiet
  3985. </pre><p>
  3986. </p></li>
  3987. <li class="listitem"><p><code class="option">--noprogress</code> does not display progress details as they occur;
  3988. instead, the final status details (such as documents indexed, speed of indexing and so on
  3989. are only reported at completion of indexing. In instances where the script is not being
  3990. run on a console (or 'tty'), this will be on by default. Example usage:
  3991. </p><pre class="programlisting">
  3992. $ indexer --rotate --all --noprogress
  3993. </pre><p>
  3994. </p></li>
  3995. <li class="listitem"><p><code class="option">--buildstops &lt;outputfile.text&gt; &lt;N&gt;</code> reviews
  3996. the index source, as if it were indexing the data, and produces a list of the terms
  3997. that are being indexed. In other words, it produces a list of all the searchable terms
  3998. that are becoming part of the index. Note; it does not update the index in question,
  3999. it simply processes the data 'as if' it were indexing, including running queries
  4000. defined with <code class="option">sql_query_pre</code> or <code class="option">sql_query_post</code>.
  4001. <code class="filename">outputfile.txt</code> will contain the list of words, one per line,
  4002. sorted by frequency with most frequent first, and <code class="filename">N</code> specifies
  4003. the maximum number of words that will be listed; if sufficiently large to encompass
  4004. every word in the index, only that many words will be returned. Such a dictionary list
  4005. could be used for client application features around "Did you mean..." functionality,
  4006. usually in conjunction with <code class="option">--buildfreqs</code>, below. Example:
  4007. </p><pre class="programlisting">
  4008. $ indexer myindex --buildstops word_freq.txt 1000
  4009. </pre><p>
  4010. This would produce a document in the current directory, <code class="filename">word_freq.txt</code>
  4011. with the 1,000 most common words in 'myindex', ordered by most common first. Note that
  4012. the file will pertain to the last index indexed when specified with multiple indexes or
  4013. <code class="option">--all</code> (i.e. the last one listed in the configuration file)
  4014. </p></li>
  4015. <li class="listitem"><p><code class="option">--buildfreqs</code> works with <code class="option">--buildstops</code>
  4016. (and is ignored if <code class="option">--buildstops</code> is not specified).
  4017. As <code class="option">--buildstops</code> provides the list of words used within the index,
  4018. <code class="option">--buildfreqs</code> adds the quantity present in the index, which would be
  4019. useful in establishing whether certain words should be considered stopwords
  4020. if they are too prevalent. It will also help with developing "Did you mean..."
  4021. features where you can how much more common a given word compared to another,
  4022. similar one. Example:
  4023. </p><pre class="programlisting">
  4024. $ indexer myindex --buildstops word_freq.txt 1000 --buildfreqs
  4025. </pre><p>
  4026. This would produce the <code class="filename">word_freq.txt</code> as above, however after each word would be the number of times it occurred in the index in question.
  4027. </p></li>
  4028. <li class="listitem"><p><code class="option">--merge &lt;dst-index&gt; &lt;src-index&gt;</code> is used
  4029. for physically merging indexes together, for example if you have a main+delta scheme,
  4030. where the main index rarely changes, but the delta index is rebuilt frequently,
  4031. and <code class="option">--merge</code> would be used to combine the two. The operation moves
  4032. from right to left - the contents of <code class="filename">src-index</code> get examined
  4033. and physically combined with the contents of <code class="filename">dst-index</code>
  4034. and the result is left in <code class="filename">dst-index</code>.
  4035. In pseudo-code, it might be expressed as: <code class="code">dst-index += src-index</code>
  4036. An example:
  4037. </p><pre class="programlisting">
  4038. $ indexer --merge main delta --rotate
  4039. </pre><p>
  4040. In the above example, where the main is the master, rarely modified index,
  4041. and delta is the less frequently modified one, you might use the above to call
  4042. <code class="filename">indexer</code> to combine the contents of the delta into the
  4043. main index and rotate the indexes.
  4044. </p></li>
  4045. <li class="listitem"><p><code class="option">--merge-dst-range &lt;attr&gt; &lt;min&gt; &lt;max&gt;</code>
  4046. runs the filter range given upon merging. Specifically, as the merge is applied
  4047. to the destination index (as part of <code class="option">--merge</code>, and is ignored
  4048. if <code class="option">--merge</code> is not specified), <code class="filename">indexer</code>
  4049. will also filter the documents ending up in the destination index, and only
  4050. documents will pass through the filter given will end up in the final index.
  4051. This could be used for example, in an index where there is a 'deleted' attribute,
  4052. where 0 means 'not deleted'. Such an index could be merged with:
  4053. </p><pre class="programlisting">
  4054. $ indexer --merge main delta --merge-dst-range deleted 0 0
  4055. </pre><p>
  4056. Any documents marked as deleted (value 1) would be removed from the newly-merged
  4057. destination index. It can be added several times to the command line,
  4058. to add successive filters to the merge, all of which must be met in order
  4059. for a document to become part of the final index.
  4060. </p></li>
  4061. <li class="listitem"><p><code class="option">--merge-killlists</code> (and its
  4062. shorter alias <code class="option">--merge-klists</code>) changes the way
  4063. kill lists are processed when merging indexes. By default, both
  4064. kill lists get discarded after a merge. That supports the most typical
  4065. main+delta merge scenario. With this option enabled, however, kill lists
  4066. from both indexes get concatenated and stored into the destination index.
  4067. Note that a source (delta) index kill list will be used to suppress rows
  4068. from a destination (main) index at all times.
  4069. </p></li>
  4070. <li class="listitem"><p><code class="option">--keep-attrs</code> (added in version 2.1.1-beta)
  4071. allows to reuse existing attributes on reindexing. Whenever
  4072. the index is rebuilt, each new document id is checked for presence in the
  4073. "old" index, and if it already exists, its attributes are transferred to
  4074. the "new" index; if not found, attributes from the new index are used. If
  4075. the user has updated attributes in the index, but not in the actual source
  4076. used for the index, all updates will be lost when reindexing; using --keep-attrs
  4077. enables saving the updated attribute values from the previous index
  4078. </p></li>
  4079. <li class="listitem"><p><code class="option">--dump-rows &lt;FILE&gt;</code> dumps rows fetched
  4080. by SQL source(s) into the specified file, in a MySQL compatible syntax.
  4081. Resulting dumps are the exact representation of data as received by
  4082. <code class="filename">indexer</code> and help to repeat indexing-time issues.
  4083. </p></li>
  4084. <li class="listitem"><p><code class="option">--verbose</code> guarantees that every row that
  4085. caused problems indexing (duplicate, zero, or missing document ID;
  4086. or file field IO issues; etc) will be reported. By default, this option
  4087. is off, and problem summaries may be reported instead.
  4088. </p></li>
  4089. <li class="listitem"><p><code class="option">--sighup-each</code> is useful when you are
  4090. rebuilding many big indexes, and want each one rotated into
  4091. <code class="filename">searchd</code> as soon as possible. With
  4092. <code class="option">--sighup-each</code>, <code class="filename">indexer</code>
  4093. will send a SIGHUP signal to searchd after successfully
  4094. completing the work on each index. (The default behavior
  4095. is to send a single SIGHUP after all the indexes were built.)
  4096. </p></li>
  4097. <li class="listitem"><p><code class="option">--nohup</code> is useful when you want to check your
  4098. index with indextool before actually rotating it. indexer won't send
  4099. SIGHUP if this option is on.
  4100. </p></li>
  4101. <li class="listitem"><p><code class="option">--print-queries</code> prints out
  4102. SQL queries that <code class="filename">indexer</code> sends to
  4103. the database, along with SQL connection and disconnection
  4104. events. That is useful to diagnose and fix problems with
  4105. SQL sources.
  4106. </p></li>
  4107. </ul></div>
  4108. <p>
  4109. </p></div>
  4110. <div class="sect1" title="7.2.&nbsp;searchd command reference"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ref-searchd"></a>7.2.&nbsp;<code class="filename">searchd</code> command reference</h2></div></div></div>
  4111. <p><code class="filename">searchd</code> is the second of the two principle tools as part of Sphinx.
  4112. <code class="filename">searchd</code> is the part of the system which actually handles searches;
  4113. it functions as a server and is responsible for receiving queries, processing them and
  4114. returning a dataset back to the different APIs for client applications.</p><p>Unlike <code class="filename">indexer</code>, <code class="filename">searchd</code> is not designed
  4115. to be run either from a regular script or command-line calling, but instead either
  4116. as a daemon to be called from init.d (on Unix/Linux type systems) or to be called
  4117. as a service (on Windows-type systems), so not all of the command line options will
  4118. always apply, and so will be build-dependent.</p><p>Calling <code class="filename">searchd</code> is simply a case of:</p><pre class="programlisting">
  4119. $ searchd [OPTIONS]
  4120. </pre><p>The options available to <code class="filename">searchd</code> on all builds are:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="option">--help</code> (<code class="option">-h</code> for short) lists all of the
  4121. parameters that can be called in your particular build of <code class="filename">searchd</code>.
  4122. </p></li>
  4123. <li class="listitem"><p><code class="option">--config &lt;file&gt;</code> (<code class="option">-c &lt;file&gt;</code> for short)
  4124. tells <code class="filename">searchd</code> to use the given file as its configuration,
  4125. just as with <code class="filename">indexer</code> above.
  4126. </p></li>
  4127. <li class="listitem"><p><code class="option">--stop</code> is used to asynchronously stop <code class="filename">searchd</code>,
  4128. using the details of the PID file as specified in the <code class="filename">sphinx.conf</code> file,
  4129. so you may also need to confirm to <code class="filename">searchd</code> which configuration
  4130. file to use with the <code class="option">--config</code> option. NB, calling <code class="option">--stop</code>
  4131. will also make sure any changes applied to the indexes with
  4132. <a class="link" href="#api-func-updateatttributes" title="9.7.2.&nbsp;UpdateAttributes"><code class="code">UpdateAttributes()</code></a>
  4133. will be applied to the index files themselves. Example:
  4134. </p><pre class="programlisting">
  4135. $ searchd --config /home/myuser/sphinx.conf --stop
  4136. </pre><p>
  4137. </p></li>
  4138. <li class="listitem"><p><code class="option">--stopwait</code> is used to synchronously stop <code class="filename">searchd</code>.
  4139. <code class="option">--stop</code> essentially tells the running instance to exit (by sending it a SIGTERM)
  4140. and then immediately returns. <code class="option">--stopwait</code> will also attempt to wait until the
  4141. running <code class="filename">searchd</code> instance actually finishes the shutdown (eg. saves all
  4142. the pending attribute changes) and exits. Example:
  4143. </p><pre class="programlisting">
  4144. $ searchd --config /home/myuser/sphinx.conf --stopwait
  4145. </pre><p>
  4146. Possible exit codes are as follows:
  4147. </p><div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>0 on success;</p></li>
  4148. <li class="listitem"><p>1 if connection to running searchd daemon failed;</p></li>
  4149. <li class="listitem"><p>2 if daemon reported an error during shutdown;</p></li>
  4150. <li class="listitem"><p>3 if daemon crashed during shutdown.</p></li>
  4151. </ul></div>
  4152. <p>
  4153. </p></li>
  4154. <li class="listitem"><p><code class="option">--status</code> command is used to query running
  4155. <code class="filename">searchd</code> instance status, using the connection details
  4156. from the (optionally) provided configuration file. It will try to connect
  4157. to the running instance using the first configured UNIX socket or TCP port.
  4158. On success, it will query for a number of status and performance counter
  4159. values and print them. You can use <a class="link" href="#api-func-status" title="9.7.5.&nbsp;Status">Status()</a>
  4160. API call to access the very same counters from your application. Examples:
  4161. </p><pre class="programlisting">
  4162. $ searchd --status
  4163. $ searchd --config /home/myuser/sphinx.conf --status
  4164. </pre><p>
  4165. </p></li>
  4166. <li class="listitem"><p><code class="option">--pidfile</code> is used to explicitly force
  4167. using a PID file (where the <code class="filename">searchd</code> process number
  4168. is stored) despite any other debugging options that say otherwise
  4169. (for instance, <code class="option">--console</code>). This is a debugging option.
  4170. </p><pre class="programlisting">
  4171. $ searchd --console --pidfile
  4172. </pre><p>
  4173. </p></li>
  4174. <li class="listitem"><p><code class="option">--console</code> is used to force <code class="filename">searchd</code>
  4175. into console mode; typically it will be running as a conventional server application,
  4176. and will aim to dump information into the log files (as specified in
  4177. <code class="filename">sphinx.conf</code>). Sometimes though, when debugging issues
  4178. in the configuration or the daemon itself, or trying to diagnose hard-to-track-down
  4179. problems, it may be easier to force it to dump information directly
  4180. to the console/command line from which it is being called. Running in console mode
  4181. also means that the process will not be forked (so searches are done in sequence)
  4182. and logs will not be written to. (It should be noted that console mode
  4183. is not the intended method for running <code class="filename">searchd</code>.)
  4184. You can invoke it as such:
  4185. </p><pre class="programlisting">
  4186. $ searchd --config /home/myuser/sphinx.conf --console
  4187. </pre><p>
  4188. </p></li>
  4189. <li class="listitem"><p><code class="option">--logdebug</code>, <code class="option">--logdebugv</code>,
  4190. and <code class="option">--logdebugvv</code> options enable additional debug output
  4191. in the daemon log. They differ by the logging verboseness level. These are
  4192. debugging options, they pollute the log a lot, and thus they should
  4193. <span class="emphasis"><em>not</em></span> be normally enabled. (The normal use case for
  4194. these is to enable them temporarily on request, to assist with some
  4195. particularly complicated debugging session.)
  4196. </p></li>
  4197. <li class="listitem"><p><code class="option">--iostats</code> is used in conjunction with the
  4198. logging options (the <code class="option">query_log</code> will need to have been
  4199. activated in <code class="filename">sphinx.conf</code>) to provide more detailed
  4200. information on a per-query basis as to the input/output operations
  4201. carried out in the course of that query, with a slight performance hit
  4202. and of course bigger logs. Further details are available under the
  4203. <a class="link" href="#query-log-format" title="5.9.&nbsp;searchd query log formats">query log format</a> section.
  4204. You might start <code class="filename">searchd</code> thus:
  4205. </p><pre class="programlisting">
  4206. $ searchd --config /home/myuser/sphinx.conf --iostats
  4207. </pre><p>
  4208. </p></li>
  4209. <li class="listitem"><p><code class="option">--cpustats</code> is used to provide actual CPU time
  4210. report (in addition to wall time) in both query log file (for every given
  4211. query) and status report (aggregated). It depends on clock_gettime() system
  4212. call and might therefore be unavailable on certain systems. You might start
  4213. <code class="filename">searchd</code> thus:
  4214. </p><pre class="programlisting">
  4215. $ searchd --config /home/myuser/sphinx.conf --cpustats
  4216. </pre><p>
  4217. </p></li>
  4218. <li class="listitem"><p><code class="option">--port portnumber</code> (<code class="option">-p</code> for short)
  4219. is used to specify the port that <code class="filename">searchd</code> should listen on,
  4220. usually for debugging purposes. This will usually default to 9312, but sometimes
  4221. you need to run it on a different port. Specifying it on the command line
  4222. will override anything specified in the configuration file. The valid range
  4223. is 0 to 65535, but ports numbered 1024 and below usually require
  4224. a privileged account in order to run. An example of usage:
  4225. </p><pre class="programlisting">
  4226. $ searchd --port 9313
  4227. </pre><p>
  4228. </p></li>
  4229. <li class="listitem"><p><code class="option">--listen ( address ":" port | port | path ) [ ":" protocol ]</code>
  4230. (or <code class="option">-l</code> for short) Works as <code class="option">--port</code>, but allow
  4231. you to specify not only the port, but full path, as IP address and port, or
  4232. Unix-domain socket path, that <code class="filename">searchd</code> will listen on.
  4233. Otherwords, you can specify either an IP address (or hostname) and port number, or
  4234. just a port number, or Unix socket path. If you specify port number
  4235. but not the address, searchd will listen on all network interfaces.
  4236. Unix path is identified by a leading slash. As the last param you
  4237. can also specify a protocol handler (listener) to be used for
  4238. connections on this socket. Supported protocol values are 'sphinx'
  4239. (Sphinx 0.9.x API protocol) and 'mysql41' (MySQL protocol used since
  4240. 4.1 upto at least 5.1).</p></li>
  4241. <li class="listitem"><p><code class="option">--index &lt;index&gt;</code> (or <code class="option">-i
  4242. &lt;index&gt;</code> for short) forces this instance of
  4243. <code class="filename">searchd</code> only to serve the specified index.
  4244. Like <code class="option">--port</code>, above, this is usually for debugging purposes;
  4245. more long-term changes would generally be applied to the configuration file
  4246. itself. Example usage:
  4247. </p><pre class="programlisting">
  4248. $ searchd --index myindex
  4249. </pre><p>
  4250. </p></li>
  4251. <li class="listitem"><p><code class="option">--strip-path</code> strips the path names from
  4252. all the file names referenced from the index (stopwords, wordforms,
  4253. exceptions, etc). This is useful for picking up indexes built on another
  4254. machine with possibly different path layouts.
  4255. </p></li>
  4256. <li class="listitem"><p><code class="option">--replay-flags=&lt;OPTIONS&gt;</code> switch,
  4257. added in version 2.0.2-beta, can be used to specify a list of extra binary log
  4258. replay options. The supported options are:
  4259. </p><div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p><code class="option">accept-desc-timestamp</code>,
  4260. ignore descending transaction timestamps and replay such
  4261. transactions anyway (the default behavior is to exit
  4262. with an error).
  4263. </p></li>
  4264. </ul></div>
  4265. <p>
  4266. Example:
  4267. </p><pre class="programlisting">
  4268. $ searchd --replay-flags=accept-desc-timestamp
  4269. </pre><p>
  4270. </p></li>
  4271. </ul></div>
  4272. <p>There are some options for <code class="filename">searchd</code> that are specific
  4273. to Windows platforms, concerning handling as a service, are only be available on Windows binaries.</p><p>Note that on Windows searchd will default to <code class="option">--console</code> mode, unless you install it as a service.</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="option">--install</code> installs <code class="filename">searchd</code> as a service
  4274. into the Microsoft Management Console (Control Panel / Administrative Tools / Services).
  4275. Any other parameters specified on the command line, where <code class="option">--install</code>
  4276. is specified will also become part of the command line on future starts of the service.
  4277. For example, as part of calling <code class="filename">searchd</code>, you will likely also need
  4278. to specify the configuration file with <code class="option">--config</code>, and you would do that
  4279. as well as specifying <code class="option">--install</code>. Once called, the usual start/stop
  4280. facilities will become available via the management console, so any methods you could
  4281. use for starting, stopping and restarting services would also apply to
  4282. <code class="filename">searchd</code>. Example:
  4283. </p><pre class="programlisting">
  4284. C:\WINDOWS\system32&gt; C:\Sphinx\bin\searchd.exe --install
  4285. --config C:\Sphinx\sphinx.conf
  4286. </pre><p>
  4287. If you wanted to have the I/O stats every time you started <code class="filename">searchd</code>,
  4288. you would specify its option on the same line as the <code class="option">--install</code> command thus:
  4289. </p><pre class="programlisting">
  4290. C:\WINDOWS\system32&gt; C:\Sphinx\bin\searchd.exe --install
  4291. --config C:\Sphinx\sphinx.conf --iostats
  4292. </pre><p>
  4293. </p></li>
  4294. <li class="listitem"><p><code class="option">--delete</code> removes the service from the Microsoft Management Console
  4295. and other places where services are registered, after previously installed with
  4296. <code class="option">--install</code>. Note, this does not uninstall the software or delete the indexes.
  4297. It means the service will not be called from the services systems, and will not be started
  4298. on the machine's next start. If currently running as a service, the current instance
  4299. will not be terminated (until the next reboot, or <code class="filename">searchd</code> is called
  4300. with <code class="option">--stop</code>). If the service was installed with a custom name
  4301. (with <code class="option">--servicename</code>), the same name will need to be specified
  4302. with <code class="option">--servicename</code> when calling to uninstall. Example:
  4303. </p><pre class="programlisting">
  4304. C:\WINDOWS\system32&gt; C:\Sphinx\bin\searchd.exe --delete
  4305. </pre><p>
  4306. </p></li>
  4307. <li class="listitem"><p><code class="option">--servicename &lt;name&gt;</code> applies the given name to
  4308. <code class="filename">searchd</code> when installing or deleting the service, as would appear
  4309. in the Management Console; this will default to searchd, but if being deployed on servers
  4310. where multiple administrators may log into the system, or a system with multiple
  4311. <code class="filename">searchd</code> instances, a more descriptive name may be applicable.
  4312. Note that unless combined with <code class="option">--install</code> or <code class="option">--delete</code>,
  4313. this option does not do anything. Example:
  4314. </p><pre class="programlisting">
  4315. C:\WINDOWS\system32&gt; C:\Sphinx\bin\searchd.exe --install
  4316. --config C:\Sphinx\sphinx.conf --servicename SphinxSearch
  4317. </pre><p>
  4318. </p></li>
  4319. <li class="listitem"><p><code class="option">--ntservice</code> is the option that is passed by the
  4320. Management Console to <code class="filename">searchd</code> to invoke it as a service
  4321. on Windows platforms. It would not normally be necessary to call this directly;
  4322. this would normally be called by Windows when the service would be started,
  4323. although if you wanted to call this as a regular service from the command-line
  4324. (as the complement to <code class="option">--console</code>) you could do so in theory.
  4325. </p></li>
  4326. <li class="listitem"><p><code class="option">--safetrace</code> forces <code class="filename">searchd</code>
  4327. to only use system backtrace() call in crash reports. In certain (rare) scenarios,
  4328. this might be a "safer" way to get that report. This is a debugging option.
  4329. </p></li>
  4330. <li class="listitem"><p><code class="option">--nodetach</code> switch (Linux only) tells
  4331. <code class="filename">searchd</code> not to detach into background. This will also
  4332. cause log entry to be printed out to console. Query processing operates
  4333. as usual. This is a debugging option.
  4334. </p></li>
  4335. </ul></div>
  4336. <p>
  4337. Last but not least, as every other daemon, <code class="filename">searchd</code> supports a number of signals.
  4338. </p><div class="variablelist"><dl><dt><span class="term">SIGTERM</span></dt>
  4339. <dd><p>Initiates a clean shutdown. New queries will not be handled; but queries
  4340. that are already started will not be forcibly interrupted.</p></dd><dt><span class="term">SIGHUP</span></dt>
  4341. <dd><p>Initiates index rotation. Depending on the value of
  4342. <a class="link" href="#conf-seamless-rotate" title="12.4.9.&nbsp;seamless_rotate">seamless_rotate</a> setting,
  4343. new queries might be shortly stalled; clients will receive temporary
  4344. errors.</p></dd><dt><span class="term">SIGUSR1</span></dt>
  4345. <dd><p>Forces reopen of searchd log and query log files, letting
  4346. you implement log file rotation.</p></dd></dl></div>
  4347. <p>
  4348. </p></div>
  4349. <div class="sect1" title="7.3.&nbsp;spelldump command reference"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ref-spelldump"></a>7.3.&nbsp;<code class="filename">spelldump</code> command reference</h2></div></div></div>
  4350. <p><code class="filename">spelldump</code> is one of the helper tools within the Sphinx package.</p><p>It is used to extract the contents of a dictionary file that uses
  4351. <code class="filename">ispell</code> or <code class="filename">MySpell</code> format, which
  4352. can help build word lists for <em class="glossterm">wordforms</em> - all of
  4353. the possible forms are pre-built for you.</p><p>Its general usage is:</p><pre class="programlisting">
  4354. spelldump [options] &lt;dictionary&gt; &lt;affix&gt; [result] [locale-name]
  4355. </pre><p>The two main parameters are the dictionary's main file and its affix
  4356. file; usually these are named as
  4357. <code class="filename">[language-prefix].dict</code> and
  4358. <code class="filename">[language-prefix].aff</code> and will be available with most
  4359. common Linux distributions, as well as various places online.</p><p><code class="option">[result]</code> specifies where the dictionary data should
  4360. be output to, and <code class="option">[locale-name]</code> additionally specifies
  4361. the locale details you wish to use.</p><p>There is an additional option, <code class="option">-c [file]</code>, which
  4362. specifies a file for case conversion details.</p><p>Examples of its usage are:</p><pre class="programlisting">
  4363. spelldump en.dict en.aff
  4364. spelldump ru.dict ru.aff ru.txt ru_RU.CP1251
  4365. spelldump ru.dict ru.aff ru.txt .1251
  4366. </pre><p>The results file will contain a list of all the words in the
  4367. dictionary in alphabetical order, output in the format of a wordforms file,
  4368. which you can use to customize for your specific circumstances. An example
  4369. of the result file:</p><pre class="programlisting">
  4370. zone &gt; zone
  4371. zoned &gt; zoned
  4372. zoning &gt; zoning
  4373. </pre></div>
  4374. <div class="sect1" title="7.4.&nbsp;indextool command reference"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ref-indextool"></a>7.4.&nbsp;<code class="filename">indextool</code> command reference</h2></div></div></div>
  4375. <p>
  4376. <code class="filename">indextool</code> is one of the helper tools within
  4377. the Sphinx package, introduced in version 0.9.9-rc2. It is used to
  4378. dump miscellaneous debug information about the physical index.
  4379. (Additional functionality such as index verification is planned
  4380. in the future, hence the indextool name rather than just indexdump.)
  4381. Its general usage is:
  4382. </p><pre class="programlisting">
  4383. indextool &lt;command&gt; [options]
  4384. </pre><p>
  4385. Options apply to all commands:
  4386. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="option">--config &lt;file&gt;</code> (<code class="option">-c &lt;file&gt;</code> for short)
  4387. overrides the built-in config file names.
  4388. </p></li>
  4389. <li class="listitem"><p><code class="option">--quiet</code> (<code class="option">-q</code> for short)
  4390. keep indextool quiet - it will not output banner, etc.
  4391. </p></li>
  4392. </ul></div>
  4393. <p>
  4394. </p><p>
  4395. The commands are as follows:
  4396. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="option">--checkconfig</code> just loads and verifies the
  4397. config file to check if it's valid, without syntax errors.
  4398. This option was added in version 2.1.1-beta.
  4399. </p></li>
  4400. <li class="listitem"><p><code class="option">--build-infixes INDEXNAME</code> build infixes for
  4401. an existing dict=keywords index (upgrades .sph, .spi in place). You can use
  4402. this option for legacy index files that already use dict=keywords, but now
  4403. need to support infix searching too; updating the index files with indextool
  4404. may prove easier or faster than regenerating them from scratch with indexer.
  4405. This option was added in version 2.1.1-beta.
  4406. </p></li>
  4407. <li class="listitem"><p><code class="option">--dumpheader FILENAME.sph</code> quickly dumps
  4408. the provided index header file without touching any other index files
  4409. or even the configuration file. The report provides a breakdown of
  4410. all the index settings, in particular the entire attribute and
  4411. field list. Prior to 0.9.9-rc2, this command was present in now removed
  4412. CLI search utility.
  4413. </p></li>
  4414. <li class="listitem"><p><code class="option">--dumpconfig FILENAME.sph</code> dumps
  4415. the index definition from the given index header file in (almost)
  4416. compliant <code class="filename">sphinx.conf</code> file format.
  4417. Added in version 2.0.1-beta.
  4418. </p></li>
  4419. <li class="listitem"><p><code class="option">--dumpheader INDEXNAME</code> dumps index header
  4420. by index name with looking up the header path in the configuration file.
  4421. </p></li>
  4422. <li class="listitem"><p><code class="option">--dumpdict INDEXNAME</code> dumps dictionary. This was
  4423. added in version 2.1.1-beta.
  4424. </p></li>
  4425. <li class="listitem"><p><code class="option">--dumpdocids INDEXNAME</code> dumps document IDs
  4426. by index name. It takes the data from attribute (.spa) file and therefore
  4427. requires docinfo=extern to work.
  4428. </p></li>
  4429. <li class="listitem"><p><code class="option">--dumphitlist INDEXNAME KEYWORD</code> dumps all
  4430. the hits (occurrences) of a given keyword in a given index, with keyword
  4431. specified as text.
  4432. </p></li>
  4433. <li class="listitem"><p><code class="option">--dumphitlist INDEXNAME --wordid ID</code> dumps all
  4434. the hits (occurrences) of a given keyword in a given index, with keyword
  4435. specified as internal numeric ID.
  4436. </p></li>
  4437. <li class="listitem"><p><code class="option">--fold INDEXNAME OPTFILE</code>
  4438. This options is useful too see how actually tokenizer proceeds input.
  4439. You can feed indextool with text from file if specified or from stdin otherwise.
  4440. The output will contain spaces instead of separators (accordingly to your
  4441. charset_table settings) and lowercased letters in words.
  4442. </p></li>
  4443. <li class="listitem"><p><code class="option">--htmlstrip INDEXNAME</code> filters stdin using
  4444. HTML stripper settings for a given index, and prints the filtering
  4445. results to stdout. Note that the settings will be taken from sphinx.conf,
  4446. and not the index header.
  4447. </p></li>
  4448. <li class="listitem"><p><code class="option">--morph INDEXNAME</code> applies morphology to the
  4449. given stdin and prints the result to stdout.
  4450. </p></li>
  4451. <li class="listitem"><p><code class="option">--check INDEXNAME</code> checks the index data
  4452. files for consistency errors that might be introduced either by bugs
  4453. in <code class="filename">indexer</code> and/or hardware faults. Starting with
  4454. version 2.1.1-beta, <code class="option">--check</code> also works on RT indexes, RAM and disk chunks.
  4455. </p></li>
  4456. <li class="listitem"><p><code class="option">--strip-path</code> strips the path names from
  4457. all the file names referenced from the index (stopwords, wordforms,
  4458. exceptions, etc). This is useful for checking indexes built on another
  4459. machine with possibly different path layouts.
  4460. </p></li>
  4461. <li class="listitem"><p><code class="option">--optimize-rt-klists</code> optimizes
  4462. the kill list memory use in the disk chunk of a given RT index. That
  4463. is a one-off optimization intended for rather old RT indexes, created
  4464. by development versions prior to 1.10-beta release. As of 1.10-beta
  4465. releases, this kill list optimization (purging) should happen
  4466. automatically, and there should never be a need to use this option.
  4467. </p></li>
  4468. <li class="listitem"><p><code class="option">--rotate</code> works only with <code class="option">--check</code> and defines
  4469. whether to check index waiting for rotation, i.e. with .new extension. This
  4470. is useful when you want to check your index before actually using it.
  4471. </p></li>
  4472. </ul></div></div>
  4473. <div class="sect1" title="7.5.&nbsp;wordbreaker command reference"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ref-wordbreaker"></a>7.5.&nbsp;<code class="filename">wordbreaker</code> command reference</h2></div></div></div>
  4474. <p>
  4475. <code class="filename">wordbreaker</code> is one of the helper tools within
  4476. the Sphinx package, introduced in version 2.1.1-beta. It is used to
  4477. split compound words, as usual in URLs, into its component words.
  4478. For example, this tool can split "lordoftherings" into its four
  4479. component words, or "http://manofsteel.warnerbros.com" into "man
  4480. of steel warner bros". This helps searching, without requiring
  4481. prefixes or infixes: searching for "sphinx" wouldn't match "sphinxsearch"
  4482. but if you break the compound word and index the separate components,
  4483. you'll get a match without the costs of prefix and infix larger index files.
  4484. </p><p>Examples of its usage are:</p><pre class="programlisting">
  4485. echo manofsteel | bin/wordbreaker -dict dict.txt split
  4486. </pre><p>The input stream will be separated in words using the <code class="option">-dict</code>
  4487. dictionary file. (The dictionary should match the language of the compound word.)
  4488. The <code class="option">split</code> command breaks words from the standard input, and
  4489. outputs the result in the standard output. There are also <code class="option">test</code> and
  4490. <code class="option">bench</code> commands that let you test the splitting quality and benchmark
  4491. the splitting functionality.
  4492. </p><p>Wordbreaker
  4493. Wordbreaker needs a dictionary to recognize individual substrings within a string. To
  4494. differentiate between different guesses, it uses the relative frequency of each
  4495. word in the dictionary: higher frequency means higher split probability. You can
  4496. generate such a file using the <code class="filename">indexer</code> tool, as in
  4497. </p><pre class="programlisting">
  4498. indexer --buildstops dict.txt 100000 --buildfreqs myindex -c /path/to/sphinx.conf
  4499. </pre><p>
  4500. which will write the 100,000 most frequent words, along with their counts, from
  4501. myindex into dict.txt. The output file is a text file, so you can edit it by hand,
  4502. if need be, to add or remove words.
  4503. </p><p>See
  4504. <a class="ulink" href="http://sphinxsearch.com/blog/2013/01/29/a-new-tool-in-the-trunk-wordbreaker/" target="_top">
  4505. http://sphinxsearch.com/blog/2013/01/29/a-new-tool-in-the-trunk-wordbreaker/</a>
  4506. for more on this tool.
  4507. </p></div></div>
  4508. <div class="chapter" title="Chapter&nbsp;8.&nbsp;SphinxQL reference"><div class="titlepage"><div><div><h2 class="title"><a name="sphinxql-reference"></a>Chapter&nbsp;8.&nbsp;SphinxQL reference</h2></div></div></div>
  4509. <div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#sphinxql-select">8.1. SELECT syntax</a></span></dt>
  4510. <dt><span class="sect1"><a href="#sphinxql-select-sysvar">8.2. SELECT @@system_variable syntax</a></span></dt>
  4511. <dt><span class="sect1"><a href="#sphinxql-show-meta">8.3. SHOW META syntax</a></span></dt>
  4512. <dt><span class="sect1"><a href="#sphinxql-show-warnings">8.4. SHOW WARNINGS syntax</a></span></dt>
  4513. <dt><span class="sect1"><a href="#sphinxql-show-status">8.5. SHOW STATUS syntax</a></span></dt>
  4514. <dt><span class="sect1"><a href="#sphinxql-insert">8.6. INSERT and REPLACE syntax</a></span></dt>
  4515. <dt><span class="sect1"><a href="#sphinxql-replace">8.7. REPLACE syntax</a></span></dt>
  4516. <dt><span class="sect1"><a href="#sphinxql-delete">8.8. DELETE syntax</a></span></dt>
  4517. <dt><span class="sect1"><a href="#sphinxql-set">8.9. SET syntax</a></span></dt>
  4518. <dt><span class="sect1"><a href="#sphinxql-set-transaction">8.10. SET TRANSACTION syntax</a></span></dt>
  4519. <dt><span class="sect1"><a href="#sphinxql-commit">8.11. BEGIN, COMMIT, and ROLLBACK syntax</a></span></dt>
  4520. <dt><span class="sect1"><a href="#sphinxql-begin">8.12. BEGIN syntax</a></span></dt>
  4521. <dt><span class="sect1"><a href="#sphinxql-rollback">8.13. ROLLBACK syntax</a></span></dt>
  4522. <dt><span class="sect1"><a href="#sphinxql-call-snippets">8.14. CALL SNIPPETS syntax</a></span></dt>
  4523. <dt><span class="sect1"><a href="#sphinxql-call-keywords">8.15. CALL KEYWORDS syntax</a></span></dt>
  4524. <dt><span class="sect1"><a href="#sphinxql-show-tables">8.16. SHOW TABLES syntax</a></span></dt>
  4525. <dt><span class="sect1"><a href="#sphinxql-describe">8.17. DESCRIBE syntax</a></span></dt>
  4526. <dt><span class="sect1"><a href="#sphinxql-create-function">8.18. CREATE FUNCTION syntax</a></span></dt>
  4527. <dt><span class="sect1"><a href="#sphinxql-drop-function">8.19. DROP FUNCTION syntax</a></span></dt>
  4528. <dt><span class="sect1"><a href="#sphinxql-show-variables">8.20. SHOW VARIABLES syntax</a></span></dt>
  4529. <dt><span class="sect1"><a href="#sphinxql-show-collation">8.21. SHOW COLLATION syntax</a></span></dt>
  4530. <dt><span class="sect1"><a href="#sphinxql-show-character-set">8.22. SHOW CHARACTER SET syntax</a></span></dt>
  4531. <dt><span class="sect1"><a href="#sphinxql-update">8.23. UPDATE syntax</a></span></dt>
  4532. <dt><span class="sect1"><a href="#sphinxql-attach">8.24. ALTER syntax</a></span></dt>
  4533. <dt><span class="sect1"><a href="#sphinxql-attach-index">8.25. ATTACH INDEX syntax</a></span></dt>
  4534. <dt><span class="sect1"><a href="#sphinxql-flush-rtindex">8.26. FLUSH RTINDEX syntax</a></span></dt>
  4535. <dt><span class="sect1"><a href="#sphinxql-flush-ramchunk">8.27. FLUSH RAMCHUNK syntax</a></span></dt>
  4536. <dt><span class="sect1"><a href="#sphinxql-truncate-rtindex">8.28. TRUNCATE RTINDEX syntax</a></span></dt>
  4537. <dt><span class="sect1"><a href="#sphinxql-show-agent-status">8.29. SHOW AGENT STATUS</a></span></dt>
  4538. <dt><span class="sect1"><a href="#sphinxql-show-profile">8.30. SHOW PROFILE syntax</a></span></dt>
  4539. <dt><span class="sect1"><a href="#sphinxql-show-index-status">8.31. SHOW INDEX STATUS syntax</a></span></dt>
  4540. <dt><span class="sect1"><a href="#sphinxql-show-index-settings">8.32. SHOW INDEX SETTINGS syntax</a></span></dt>
  4541. <dt><span class="sect1"><a href="#sphinxql-optimize-index">8.33. OPTIMIZE INDEX syntax</a></span></dt>
  4542. <dt><span class="sect1"><a href="#sphinxql-show-plan">8.34. SHOW PLAN syntax</a></span></dt>
  4543. <dt><span class="sect1"><a href="#sphinxql-show-databases">8.35. SHOW DATABASES syntax</a></span></dt>
  4544. <dt><span class="sect1"><a href="#sphinxql-create-plugin">8.36. CREATE PLUGIN syntax</a></span></dt>
  4545. <dt><span class="sect1"><a href="#sphinxql-drop-plugin">8.37. DROP PLUGIN syntax</a></span></dt>
  4546. <dt><span class="sect1"><a href="#sphinxql-show-plugins">8.38. SHOW PLUGINS syntax</a></span></dt>
  4547. <dt><span class="sect1"><a href="#sphinxql-threads">8.39. SHOW THREADS syntax</a></span></dt>
  4548. <dt><span class="sect1"><a href="#sphinxql-multi-queries">8.40. Multi-statement queries</a></span></dt>
  4549. <dt><span class="sect1"><a href="#sphinxql-comment-syntax">8.41. Comment syntax</a></span></dt>
  4550. <dt><span class="sect1"><a href="#sphinxql-reserved-keywords">8.42. List of SphinxQL reserved keywords</a></span></dt>
  4551. <dt><span class="sect1"><a href="#sphinxql-upgrading-magics">8.43. SphinxQL upgrade notes, version 2.0.1-beta</a></span></dt>
  4552. </dl></div>
  4553. <p>
  4554. SphinxQL is our SQL dialect that exposes all of the search daemon
  4555. functionality using a standard SQL syntax with a few Sphinx-specific
  4556. extensions. Everything available via the SphinxAPI is also available
  4557. via SphinxQL but not vice versa; for instance, writes into RT indexes
  4558. are only available via SphinxQL. This chapter documents supported
  4559. SphinxQL statements syntax.
  4560. </p><div class="sect1" title="8.1.&nbsp;SELECT syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-select"></a>8.1.&nbsp;SELECT syntax</h2></div></div></div>
  4561. <pre class="programlisting">
  4562. SELECT
  4563. select_expr [, select_expr ...]
  4564. FROM index [, index2 ...]
  4565. [WHERE where_condition]
  4566. [GROUP [N] BY {col_name | expr_alias} [, {col_name | expr_alias}]]
  4567. [WITHIN GROUP ORDER BY {col_name | expr_alias} {ASC | DESC}]
  4568. [HAVING having_condition]
  4569. [ORDER BY {col_name | expr_alias} {ASC | DESC} [, ...]]
  4570. [LIMIT [offset,] row_count]
  4571. [OPTION opt_name = opt_value [, ...]]
  4572. [FACET facet_options[ FACET facet_options][ ...]]
  4573. </pre><p>
  4574. <span class="bold"><strong>SELECT</strong></span> statement was introduced in version 0.9.9-rc2.
  4575. It's syntax is based upon regular SQL but adds several Sphinx-specific
  4576. extensions and has a few omissions (such as (currently) missing support for JOINs).
  4577. Specifically,
  4578. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Column list clause. Column names, arbitrary expressions,
  4579. and star ('*') are all allowed (ie.
  4580. <code class="code">SELECT id, group_id*123+456 AS expr1 FROM test1</code>
  4581. will work). Unlike in regular SQL, all computed expressions must be aliased
  4582. with a valid identifier. Starting with version 2.0.1-beta, <code class="code">AS</code>
  4583. is optional.
  4584. </p></li>
  4585. <li class="listitem"><p>EXIST() function (added in version 2.1.1-beta) is supported.
  4586. EXIST ( "attr-name", default-value )
  4587. replaces non-existent columns with default values. It returns either a value
  4588. of an attribute specified by 'attr-name', or 'default-value' if that
  4589. attribute does not exist. As of 2.1.1-beta it does not support STRING
  4590. or MVA attributes. This function is handy when you are searching through
  4591. several indexes with different schemas.
  4592. </p><pre class="programlisting">
  4593. SELECT *, EXIST('gid', 6) as cnd FROM i1, i2 WHERE cnd&gt;5
  4594. </pre></li>
  4595. <li class="listitem"><p>SNIPPET() function (added in version 2.1.1-beta) is supported.
  4596. This is a wrapper around the snippets functionality, similar to what is
  4597. available via CALL SNIPPETS. The first two arguments are: the text
  4598. to highlight, and a query. Starting with 2.2-1-beta it's possible to pass
  4599. <a class="link" href="#api-func-buildexcerpts" title="9.7.1.&nbsp;BuildExcerpts">options</a> to function.
  4600. The intended use is as follows:
  4601. </p><pre class="programlisting">
  4602. SELECT id, SNIPPET(myUdf(id), 'my.query', 'limit=100')
  4603. FROM myIndex WHERE MATCH('my.query')
  4604. </pre><p>
  4605. where myUdf() would be a UDF that fetches a document by its ID from
  4606. some external storage. This enables applications to fetch the entire
  4607. result set directly from Sphinx in one query, without having to separately
  4608. fetch the documents in the application and then send them back to Sphinx
  4609. for highlighting.
  4610. </p><p>
  4611. SNIPPET() is a so-called "post limit" function, meaning that computing
  4612. snippets is postponed not just until the entire final result set is ready,
  4613. but even after the LIMIT clause is applied. For example, with a LIMIT 20,10
  4614. clause, SNIPPET() will be called at most 10 times.
  4615. </p><p>
  4616. Table functions is a mechanism of post-query result set processing. It was
  4617. added in 2.2.1-beta. Table functions take an arbitrary result set as their
  4618. input, and return a new, processed set as their output. The first argument
  4619. should be the input result set, but a table function can optionally take
  4620. and handle more arguments. Table functions can completely change the result
  4621. set, including the schema. For now, only built in table functions are
  4622. supported. UDFs are planned when the internal call interface is stabilized.
  4623. Table functions work for both outer SELECT and nested SELECT.
  4624. </p><div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>REMOVE_REPEATS ( result_set, column, offset, limit ) - removes repeated
  4625. adjusted rows with the same 'column' value.</p></li>
  4626. </ul></div>
  4627. <p>
  4628. </p><pre class="programlisting">
  4629. SELECT REMOVE_REPEATS((SELECT * FROM dist1), gid, 0, 10)
  4630. </pre><p>
  4631. </p></li>
  4632. <li class="listitem"><p>FROM clause. FROM clause should contain the list of indexes
  4633. to search through. Unlike in regular SQL, comma means enumeration of
  4634. full-text indexes as in <a class="link" href="#api-func-query" title="9.6.1.&nbsp;Query">Query()</a>
  4635. API call rather than JOIN. Index name should be according to the rules of
  4636. a C identifier.
  4637. </p></li>
  4638. <li class="listitem"><p>WHERE clause. This clause will map both to fulltext query
  4639. and filters. Comparison operators (=, !=, &lt;, &gt;, &lt;=, &gt;=), IN,
  4640. AND, NOT, and BETWEEN are all supported and map directly to filters.
  4641. OR is not supported yet but will be in the future. MATCH('query')
  4642. is supported and maps to fulltext query. Query will be interpreted
  4643. according to <a class="link" href="#extended-syntax" title="5.3.&nbsp;Extended query syntax">full-text query language rules</a>.
  4644. There must be at most one MATCH() in the clause. Starting with version
  4645. 2.0.1-beta, <code class="code">{col_name | expr_alias} [NOT] IN @uservar</code>
  4646. condition syntax is supported. (Refer to <a class="xref" href="#sphinxql-set" title="8.9.&nbsp;SET syntax">Section&nbsp;8.9, &#8220;SET syntax&#8221;</a>
  4647. for a discussion of global user variables.)
  4648. </p></li>
  4649. <li class="listitem"><p>GROUP BY clause. Supports grouping by multiple columns
  4650. or computed expressions:
  4651. </p><pre class="programlisting">
  4652. SELECT *, group_id*1000+article_type AS gkey FROM example GROUP BY gkey
  4653. SELECT id FROM products GROUP BY region, price
  4654. </pre><p>
  4655. Implicit grouping supported when using aggregate functions without
  4656. specifiying a GROUP BY clause. Consider these two queries:
  4657. </p><pre class="programlisting">
  4658. SELECT MAX(id), MIN(id), COUNT(*) FROM books
  4659. SELECT MAX(id), MIN(id), COUNT(*), 1 AS grp FROM books GROUP BY grp
  4660. </pre><p>
  4661. Aggregate functions (AVG(), MIN(), MAX(), SUM()) in column list
  4662. clause are supported. Arguments to aggregate functions can be either
  4663. plain attributes or arbitrary expressions. COUNT(*), COUNT(DISTINCT attr)
  4664. are supported. Currently there can be at most one COUNT(DISTINCT) per
  4665. query and an argument needs to be an attribute. Both current restrictions
  4666. on COUNT(DISTINCT) might be lifted in the future. A special GROUPBY()
  4667. function is also supported. It returns the GROUP BY key. That is
  4668. particularly useful when grouping by an MVA value, in order to pick the
  4669. specific value that was used to create the current group.
  4670. </p><pre class="programlisting">
  4671. SELECT *, AVG(price) AS avgprice, COUNT(DISTINCT storeid), GROUPBY()
  4672. FROM products
  4673. WHERE MATCH('ipod')
  4674. GROUP BY vendorid
  4675. </pre><p>
  4676. </p><p>
  4677. Starting with 2.0.1-beta, GROUP BY on a string attribute is supported,
  4678. with respect for current collation (see <a class="xref" href="#collations" title="5.12.&nbsp;Collations">Section&nbsp;5.12, &#8220;Collations&#8221;</a>).
  4679. </p><p>Starting with 2.2.1-beta, you can query Sphinx to return (no more than)
  4680. N top matches for each group accordingly to WITHIN GROUP ORDER BY.</p><pre class="programlisting">
  4681. SELECT id FROM products GROUP 3 BY category
  4682. </pre><p>
  4683. You can sort the result set by (an alias of) the aggregate value.
  4684. </p><pre class="programlisting">
  4685. SELECT group_id, MAX(id) AS max_id
  4686. FROM my_index WHERE MATCH('the')
  4687. GROUP BY group_id ORDER BY max_id DESC
  4688. </pre><p>
  4689. </p></li>
  4690. <li class="listitem"><p>GROUP_CONCAT() function is supported, starting with version 2.1.1-beta.
  4691. When you group by an attribute, the result set only shows attributes from a single document representing the whole group.
  4692. GROUP_CONCAT() produces a comma-separated list of the attribute values of all documents in the group.
  4693. </p><pre class="programlisting">
  4694. SELECT id, GROUP_CONCAT(price) as pricesList, GROUPBY() AS name FROM shops GROUP BY shopName;
  4695. </pre></li>
  4696. <li class="listitem"><p>
  4697. ZONESPANLIST() function returns pairs of matched zone spans. Each pair
  4698. contains the matched zone span identifier, a colon, and the order number
  4699. of the matched zone span. For example, if a document reads
  4700. &lt;emphasis role="bold"&gt;&lt;i&gt;text&lt;/i&gt; the &lt;i&gt;text&lt;/i&gt;&lt;/emphasis&gt;, and you query for
  4701. 'ZONESPAN:(i,b) text', then ZONESPANLIST() will return the string
  4702. "1:1 1:2 2:1" meaning that the first zone span matched "text"
  4703. in spans 1 and 2, and the second zone span in span 1 only.
  4704. This was added in version 2.1.1-beta.
  4705. </p></li>
  4706. <li class="listitem"><p>WITHIN GROUP ORDER BY clause. This is a Sphinx specific
  4707. extension that lets you control how the best row within a group
  4708. will to be selected. The syntax matches that of regular ORDER BY
  4709. clause:
  4710. </p><pre class="programlisting">
  4711. SELECT *, INTERVAL(posted,NOW()-7*86400,NOW()-86400) AS timeseg, WEIGHT() AS w
  4712. FROM example WHERE MATCH('my search query')
  4713. GROUP BY siteid
  4714. WITHIN GROUP ORDER BY w DESC
  4715. ORDER BY timeseg DESC, w DESC
  4716. </pre><p>
  4717. Starting with 2.0.1-beta, WITHIN GROUP ORDER BY on a string attribute is supported,
  4718. with respect for current collation (see <a class="xref" href="#collations" title="5.12.&nbsp;Collations">Section&nbsp;5.12, &#8220;Collations&#8221;</a>).
  4719. </p></li>
  4720. <li class="listitem"><p>
  4721. HAVING clause. This is used to filter on GROUP BY values. It was added in
  4722. 2.2.1-beta. Currently supports only one filtering condition.
  4723. </p><pre class="programlisting">
  4724. SELECT id FROM plain GROUP BY title HAVING group_id=16;
  4725. SELECT id FROM plain GROUP BY attribute HAVING COUNT(*)&gt;1;
  4726. </pre><p>
  4727. </p></li>
  4728. <li class="listitem"><p>ORDER BY clause. Unlike in regular SQL, only column names
  4729. (not expressions) are allowed and explicit ASC and DESC are required.
  4730. The columns however can be computed expressions:
  4731. </p><pre class="programlisting">
  4732. SELECT *, WEIGHT()*10+docboost AS skey FROM example ORDER BY skey
  4733. </pre><p>
  4734. Starting with 2.1.1-beta, you can use subqueries to speed up specific searches, which involve reranking, by postponing hard (slow) calculations as
  4735. late as possible. For example, SELECT id,a_slow_expression() AS cond FROM an_index ORDER BY id ASC, cond DESC LIMIT 100; could be
  4736. better written as SELECT * FROM (SELECT id,a_slow_expression() AS cond FROM an_index ORDER BY id ASC LIMIT 100) ORDER BY cond DESC;
  4737. because in the first case the slow expression would be evaluated for the whole set, while in the second one it would be
  4738. evaluated just for a subset of values.
  4739. </p><p>
  4740. Starting with 2.0.1-beta, ORDER BY on a string attribute is supported,
  4741. with respect for current collation (see <a class="xref" href="#collations" title="5.12.&nbsp;Collations">Section&nbsp;5.12, &#8220;Collations&#8221;</a>).
  4742. </p><p>
  4743. Starting with 2.0.2-beta, ORDER BY RAND() syntax is supported.
  4744. Note that this syntax is actually going to randomize the weight
  4745. values and then order matches by those randomized weights.
  4746. </p></li>
  4747. <li class="listitem"><p>LIMIT clause. Both LIMIT N and LIMIT M,N forms are supported.
  4748. Unlike in regular SQL (but like in Sphinx API), an implicit LIMIT 0,20
  4749. is present by default.
  4750. </p></li>
  4751. <li class="listitem"><p>OPTION clause. This is a Sphinx specific extension that
  4752. lets you control a number of per-query options. The syntax is:
  4753. </p><pre class="programlisting">
  4754. OPTION &lt;optionname&gt;=&lt;value&gt; [ , ... ]
  4755. </pre><p>
  4756. Supported options and respectively allowed values are:
  4757. </p><div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>'agent_query_timeout' - integer (max time in milliseconds to wait for remote queries to complete,
  4758. see <a class="link" href="#conf-agent-query-timeout" title="12.2.35.&nbsp;agent_query_timeout">agent_query_timeout</a> under Index configuration options for details)</p></li>
  4759. <li class="listitem"><p>'boolean_simplify' - 0 or 1, enables simplifying the query to speed it up</p></li>
  4760. <li class="listitem"><p>'comment' - string, user comment that gets copied to a query log file</p></li>
  4761. <li class="listitem"><p>'cutoff' - integer (max found matches threshold)</p></li>
  4762. <li class="listitem"><p>'field_weights' - a named integer list (per-field user weights for ranking)</p></li>
  4763. <li class="listitem"><p>'global_idf' - use global statistics (frequencies)
  4764. from the <a class="link" href="#conf-global-idf" title="12.2.66.&nbsp;global_idf">global_idf file</a> for IDF
  4765. computations, rather than the local index statistics.
  4766. Added in version 2.1.1-beta.
  4767. </p></li>
  4768. <li class="listitem"><p>'idf' - a quoted, comma-separated list of IDF computation flags. Added in version 2.1.1-beta.
  4769. Known flags are:
  4770. </p><div class="itemizedlist"><ul class="itemizedlist" type="square"><li class="listitem"><p>normalized: BM25 variant, idf = log((N-n+1)/n), as per Robertson et al</p></li>
  4771. <li class="listitem"><p>plain: plain variant, idf = log(N/n), as per Sparck-Jones</p></li>
  4772. <li class="listitem"><p>tfidf_normalized (added in 2.2.1-beta): additionally divide IDF
  4773. by query word count, so that TF*IDF fits into [0, 1] range</p></li>
  4774. <li class="listitem"><p>tfidf_unnormalized (added in 2.2.1-beta): do not additionally
  4775. divide IDF by query word count</p></li>
  4776. </ul></div>
  4777. <p>
  4778. where <span class="bold"><strong>N</strong></span> is the collection size and <span class="bold"><strong>n</strong></span> is the number of matched
  4779. documents.
  4780. </p><p>
  4781. The historically default IDF (Inverse Document Frequency) in Sphinx
  4782. is equivalent to <code class="code">OPTION idf='normalized,tfidf_normalized'</code>,
  4783. and those normalizations may cause several undesired effects.
  4784. </p><p>
  4785. First, idf=normalized causes keyword penalization. For instance,
  4786. if you search for [the | something] and [the] occurs
  4787. in more than 50% of the documents, then documents with both keywords
  4788. [the] and [something] will get <span class="bold"><strong>less</strong></span> weight than documents with
  4789. just one keyword [something]. Using <code class="code">OPTION idf=plain</code> avoids this.
  4790. Plain IDF varies in [0, log(N)] range, and keywords
  4791. are never penalized; while the normalized IDF varies in [-log(N), log(N)]
  4792. range, and too frequent keywords are penalized.
  4793. </p><p>
  4794. Second, idf=tfidf_normalized causes IDF drift over queries. Historically,
  4795. we additionally divided IDF by query keyword count, so that the entire
  4796. sum(tf*idf) over all keywords would still fit into [0,1] range. However,
  4797. that means that queries [word1] and [word1 | nonmatchingword2] would
  4798. assign different weights to the exactly same result set, because the IDFs
  4799. for both "word1" and "nonmatchingword2" would be divided by 2.
  4800. <code class="code">OPTION idf=tfidf_unnormalized</code> fixes that. Note that
  4801. BM25, BM25A, BM25F() ranking factors will be scale accordingly
  4802. once you disable this normalization.
  4803. </p><p>
  4804. IDF flags can be mixed; 'plain' and 'normalized' are mutually exclusive;
  4805. 'tfidf_unnormalized' and 'tfidf_normalized' are mutually exclusive;
  4806. and unspecified flags in such a mutually exclusive group take their
  4807. defaults. That means that <code class="code">OPTION idf=plain</code> is equivalent
  4808. to a complete <code class="code">OPTION idf='plain,tfidf_normalized'</code> specification.
  4809. </p></li>
  4810. <li class="listitem"><p>local_df (added in 2.2.1-beta): 0 or 1,automatically sum DFs over all the
  4811. local parts of a distributed index, so that the IDF is consistent (and precise) over
  4812. a locally sharded index.
  4813. </p></li>
  4814. <li class="listitem"><p>'index_weights' - a named integer list (per-index user weights for ranking)</p></li>
  4815. <li class="listitem"><p>'max_matches' - integer (per-query max matches value)</p><p>
  4816. Maximum amount of matches that the daemon keeps in RAM for each index and can return to the client.
  4817. Default is 1000.
  4818. </p><p>
  4819. Introduced in order to control and limit RAM usage, <code class="code">max_matches</code>
  4820. setting defines how much matches will be kept in RAM while searching each index.
  4821. Every match found will still be <span class="emphasis"><em>processed</em></span>; but only
  4822. best N of them will be kept in memory and return to the client in the end.
  4823. Assume that the index contains 2,000,000 matches for the query. You rarely
  4824. (if ever) need to retrieve <span class="emphasis"><em>all</em></span> of them. Rather, you need
  4825. to scan all of them, but only choose "best" at most, say, 500 by some criteria
  4826. (ie. sorted by relevance, or price, or anything else), and display those
  4827. 500 matches to the end user in pages of 20 to 100 matches. And tracking
  4828. only the best 500 matches is much more RAM and CPU efficient than keeping
  4829. all 2,000,000 matches, sorting them, and then discarding everything but
  4830. the first 20 needed to display the search results page. <code class="code">max_matches</code>
  4831. controls N in that "best N" amount.
  4832. </p><p>
  4833. This parameter noticeably affects per-query RAM and CPU usage.
  4834. Values of 1,000 to 10,000 are generally fine, but higher limits must be
  4835. used with care. Recklessly raising <code class="code">max_matches</code> to 1,000,000
  4836. means that <code class="filename">searchd</code> will have to allocate and
  4837. initialize 1-million-entry matches buffer for <span class="emphasis"><em>every</em></span>
  4838. query. That will obviously increase per-query RAM usage, and in some cases
  4839. can also noticeably impact performance.
  4840. </p></li>
  4841. <li class="listitem"><p>'max_query_time' - integer (max search time threshold, msec)</p></li>
  4842. <li class="listitem"><p>'max_predicted_time' - integer (max predicted search time, see <a class="xref" href="#conf-predicted-time-costs" title="12.4.44.&nbsp;predicted_time_costs">Section&nbsp;12.4.44, &#8220;predicted_time_costs&#8221;</a>)</p></li>
  4843. <li class="listitem"><p>'ranker' - any of 'proximity_bm25', 'bm25', 'none', 'wordcount', 'proximity',
  4844. 'matchany', 'fieldmask', 'sph04', 'expr', or 'export' (refer to <a class="xref" href="#weighting" title="5.4.&nbsp;Search results ranking">Section&nbsp;5.4, &#8220;Search results ranking&#8221;</a>
  4845. for more details on each ranker)</p></li>
  4846. <li class="listitem"><p>'retry_count' - integer (distributed retries count)</p></li>
  4847. <li class="listitem"><p>'retry_delay' - integer (distributed retry delay, msec)</p></li>
  4848. <li class="listitem"><p>'reverse_scan' - 0 or 1, lets you control the order in which full-scan query processes the rows</p></li>
  4849. <li class="listitem"><p>'sort_method' - 'pq' (priority queue, set by default) or 'kbuffer' (gives faster sorting for already pre-sorted data, e.g. index data sorted by id). The
  4850. result set is in both cases the same; picking one option or the other may just improve (or worsen!) performance. This option was added in version 2.1.1-beta.</p></li>
  4851. <li class="listitem"><p>'rand_seed' - lets you specify a specific integer seed value
  4852. for an <code class="code">ORDER BY RAND()</code> query, for example: ... OPTION <code class="code">rand_seed=1234</code>.
  4853. By default, a new and different seed value is autogenerated for every query.
  4854. </p></li>
  4855. </ul></div>
  4856. <p>
  4857. Example:
  4858. </p><pre class="programlisting">
  4859. SELECT * FROM test WHERE MATCH('@title hello @body world')
  4860. OPTION ranker=bm25, max_matches=3000,
  4861. field_weights=(title=10, body=3), agent_query_timeout=10000
  4862. </pre><p>
  4863. </p></li>
  4864. <li class="listitem"><p>FACET clause. This Sphinx specific extension enables faceted search with subtree optimization.
  4865. It is capable of returning multiple result sets with a single SQL statement, without the need for complicated <a class="link" href="#sphinxql-multi-queries" title="8.40.&nbsp;Multi-statement queries">multi-queries</a>.
  4866. FACET clauses should be written at the very end of SELECT statements with spaces between them.
  4867. </p><pre class="programlisting">
  4868. FACET {expr_list} [BY {expr_list}] [ORDER BY {expr | FACET()} {ASC | DESC}] [LIMIT [offset,] count]
  4869. SELECT * FROM test FACET brand_id FACET categories;
  4870. SELECT * FROM test FACET brand_name BY brand_id ORDER BY brand_name ASC FACET property;
  4871. </pre><p>
  4872. Working example:
  4873. </p><pre class="programlisting">
  4874. mysql&gt; SELECT *, IN(brand_id,1,2,3,4) AS b FROM facetdemo WHERE MATCH('Product') AND b=1 LIMIT 0,10
  4875. FACET brand_name, brand_id BY brand_id ORDER BY brand_id ASC
  4876. FACET property ORDER BY COUNT(*) DESC
  4877. FACET INTERVAL(price,200,400,600,800) ORDER BY FACET() ASC
  4878. FACET categories ORDER BY FACET() ASC;
  4879. +------+-------+----------+-------------------+-------------+----------+------------+------+
  4880. | id | price | brand_id | title | brand_name | property | categories | b |
  4881. +------+-------+----------+-------------------+-------------+----------+------------+------+
  4882. | 1 | 668 | 3 | Product Four Six | Brand Three | Three | 11,12,13 | 1 |
  4883. | 2 | 101 | 4 | Product Two Eight | Brand Four | One | 12,13,14 | 1 |
  4884. | 8 | 750 | 3 | Product Ten Eight | Brand Three | Five | 13 | 1 |
  4885. | 9 | 49 | 1 | Product Ten Two | Brand One | Three | 13,14,15 | 1 |
  4886. | 13 | 613 | 1 | Product Six Two | Brand One | Eight | 13 | 1 |
  4887. | 20 | 985 | 2 | Product Two Six | Brand Two | Nine | 10 | 1 |
  4888. | 22 | 501 | 3 | Product Five Two | Brand Three | Four | 12,13,14 | 1 |
  4889. | 23 | 765 | 1 | Product Six Seven | Brand One | Nine | 11,12 | 1 |
  4890. | 28 | 992 | 1 | Product Six Eight | Brand One | Two | 12,13 | 1 |
  4891. | 29 | 259 | 1 | Product Nine Ten | Brand One | Five | 12,13,14 | 1 |
  4892. +------+-------+----------+-------------------+-------------+----------+------------+------+
  4893. +-------------+----------+----------+
  4894. | brand_name | brand_id | count(*) |
  4895. +-------------+----------+----------+
  4896. | Brand One | 1 | 1012 |
  4897. | Brand Two | 2 | 1025 |
  4898. | Brand Three | 3 | 994 |
  4899. | Brand Four | 4 | 973 |
  4900. +-------------+----------+----------+
  4901. +----------+----------+
  4902. | property | count(*) |
  4903. +----------+----------+
  4904. | One | 427 |
  4905. | Five | 420 |
  4906. | Seven | 420 |
  4907. | Two | 418 |
  4908. | Three | 407 |
  4909. | Six | 401 |
  4910. | Nine | 396 |
  4911. | Eight | 387 |
  4912. | Four | 371 |
  4913. | Ten | 357 |
  4914. +----------+----------+
  4915. +---------------------------------+----------+
  4916. | interval(price,200,400,600,800) | count(*) |
  4917. +---------------------------------+----------+
  4918. | 0 | 799 |
  4919. | 1 | 795 |
  4920. | 2 | 757 |
  4921. | 3 | 833 |
  4922. | 4 | 820 |
  4923. +---------------------------------+----------+
  4924. +------------+----------+
  4925. | categories | count(*) |
  4926. +------------+----------+
  4927. | 10 | 961 |
  4928. | 11 | 1653 |
  4929. | 12 | 1998 |
  4930. | 13 | 2090 |
  4931. | 14 | 1058 |
  4932. | 15 | 347 |
  4933. +------------+----------+
  4934. </pre><p>
  4935. </p></li>
  4936. </ul></div>
  4937. <p>
  4938. </p></div>
  4939. <div class="sect1" title="8.2.&nbsp;SELECT @@system_variable syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-select-sysvar"></a>8.2.&nbsp;SELECT @@system_variable syntax</h2></div></div></div>
  4940. <pre class="programlisting">
  4941. SELECT @@system_variable [LIMIT [offset,] row_count]
  4942. </pre><p>
  4943. Added in version 2.0.2-beta, this is currently a placeholder
  4944. query that does nothing and reports success. That is in order
  4945. to keep compatibility with frameworks and connectors that
  4946. automatically execute this statement.
  4947. </p></div>
  4948. <div class="sect1" title="8.3.&nbsp;SHOW META syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-show-meta"></a>8.3.&nbsp;SHOW META syntax</h2></div></div></div>
  4949. <pre class="programlisting">
  4950. SHOW META [ LIKE pattern ]
  4951. </pre><p><span class="bold"><strong>SHOW META</strong></span> shows additional meta-information about the latest
  4952. query such as query time and keyword statistics. IO and CPU counters will only be available if searchd was started with --iostats and --cpustats switches respectively.
  4953. Additional predicted_time, dist_predicted_time, [{local|dist}]_fetched_[{docs|hits|skips}] counters will only be available if searchd was configured with
  4954. <a class="link" href="#conf-predicted-time-costs" title="12.4.44.&nbsp;predicted_time_costs">predicted time costs</a> and query had predicted_time in OPTION clause.
  4955. </p><pre class="programlisting">
  4956. mysql&gt; SELECT * FROM test1 WHERE MATCH('test|one|two');
  4957. +------+--------+----------+------------+
  4958. | id | weight | group_id | date_added |
  4959. +------+--------+----------+------------+
  4960. | 1 | 3563 | 456 | 1231721236 |
  4961. | 2 | 2563 | 123 | 1231721236 |
  4962. | 4 | 1480 | 2 | 1231721236 |
  4963. +------+--------+----------+------------+
  4964. 3 rows in set (0.01 sec)
  4965. mysql&gt; SHOW META;
  4966. +-----------------------+-------+
  4967. | Variable_name | Value |
  4968. +-----------------------+-------+
  4969. | total | 3 |
  4970. | total_found | 3 |
  4971. | time | 0.005 |
  4972. | keyword[0] | test |
  4973. | docs[0] | 3 |
  4974. | hits[0] | 5 |
  4975. | keyword[1] | one |
  4976. | docs[1] | 1 |
  4977. | hits[1] | 2 |
  4978. | keyword[2] | two |
  4979. | docs[2] | 1 |
  4980. | hits[2] | 2 |
  4981. | cpu_time | 0.350 |
  4982. | io_read_time | 0.004 |
  4983. | io_read_ops | 2 |
  4984. | io_read_kbytes | 0.4 |
  4985. | io_write_time | 0.000 |
  4986. | io_write_ops | 0 |
  4987. | io_write_kbytes | 0.0 |
  4988. | agents_cpu_time | 0.000 |
  4989. | agent_io_read_time | 0.000 |
  4990. | agent_io_read_ops | 0 |
  4991. | agent_io_read_kbytes | 0.0 |
  4992. | agent_io_write_time | 0.000 |
  4993. | agent_io_write_ops | 0 |
  4994. | agent_io_write_kbytes | 0.0 |
  4995. +-----------------------+-------+
  4996. 12 rows in set (0.00 sec)
  4997. </pre><p>
  4998. </p><p>
  4999. Starting version 2.1.1-beta, you can also use the optional LIKE clause.
  5000. It lets you pick just the variables that match a pattern. The pattern syntax
  5001. is that of regular SQL wildcards, that is, '%' means any number of any
  5002. characters, and '_' means a single character:
  5003. </p><pre class="programlisting">
  5004. mysql&gt; SHOW META LIKE 'total%';
  5005. +-----------------------+-------+
  5006. | Variable_name | Value |
  5007. +-----------------------+-------+
  5008. | total | 3 |
  5009. | total_found | 3 |
  5010. +-----------------------+-------+
  5011. 2 rows in set (0.00 sec)
  5012. </pre><p>
  5013. </p></div>
  5014. <div class="sect1" title="8.4.&nbsp;SHOW WARNINGS syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-show-warnings"></a>8.4.&nbsp;SHOW WARNINGS syntax</h2></div></div></div>
  5015. <pre class="programlisting">
  5016. SHOW WARNINGS
  5017. </pre><p><span class="bold"><strong>SHOW WARNINGS</strong></span> statement, introduced in version 0.9.9-rc2,
  5018. can be used to retrieve the warning
  5019. produced by the latest query. The error message will be returned along with
  5020. the query itself:
  5021. </p><pre class="programlisting">
  5022. mysql&gt; SELECT * FROM test1 WHERE MATCH('@@title hello') \G
  5023. ERROR 1064 (42000): index test1: syntax error, unexpected TOK_FIELDLIMIT
  5024. near '@title hello'
  5025. mysql&gt; SELECT * FROM test1 WHERE MATCH('@title -hello') \G
  5026. ERROR 1064 (42000): index test1: query is non-computable (single NOT operator)
  5027. mysql&gt; SELECT * FROM test1 WHERE MATCH('"test doc"/3') \G
  5028. *************************** 1. row ***************************
  5029. id: 4
  5030. weight: 2500
  5031. group_id: 2
  5032. date_added: 1231721236
  5033. 1 row in set, 1 warning (0.00 sec)
  5034. mysql&gt; SHOW WARNINGS \G
  5035. *************************** 1. row ***************************
  5036. Level: warning
  5037. Code: 1000
  5038. Message: quorum threshold too high (words=2, thresh=3); replacing quorum operator
  5039. with AND operator
  5040. 1 row in set (0.00 sec)
  5041. </pre><p>
  5042. </p></div>
  5043. <div class="sect1" title="8.5.&nbsp;SHOW STATUS syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-show-status"></a>8.5.&nbsp;SHOW STATUS syntax</h2></div></div></div>
  5044. <pre class="programlisting">
  5045. SHOW STATUS [ LIKE pattern ]
  5046. </pre><p><span class="bold"><strong>SHOW STATUS</strong></span>, introduced in version 0.9.9-rc2,
  5047. displays a number of useful performance counters. IO and CPU
  5048. counters will only be available if searchd was started with --iostats and --cpustats
  5049. switches respectively.
  5050. </p><pre class="programlisting">
  5051. mysql&gt; SHOW STATUS;
  5052. +--------------------+-------+
  5053. | Variable_name | Value |
  5054. +--------------------+-------+
  5055. | uptime | 216 |
  5056. | connections | 3 |
  5057. | maxed_out | 0 |
  5058. | command_search | 0 |
  5059. | command_excerpt | 0 |
  5060. | command_update | 0 |
  5061. | command_keywords | 0 |
  5062. | command_persist | 0 |
  5063. | command_status | 0 |
  5064. | agent_connect | 0 |
  5065. | agent_retry | 0 |
  5066. | queries | 10 |
  5067. | dist_queries | 0 |
  5068. | query_wall | 0.075 |
  5069. | query_cpu | OFF |
  5070. | dist_wall | 0.000 |
  5071. | dist_local | 0.000 |
  5072. | dist_wait | 0.000 |
  5073. | query_reads | OFF |
  5074. | query_readkb | OFF |
  5075. | query_readtime | OFF |
  5076. | avg_query_wall | 0.007 |
  5077. | avg_query_cpu | OFF |
  5078. | avg_dist_wall | 0.000 |
  5079. | avg_dist_local | 0.000 |
  5080. | avg_dist_wait | 0.000 |
  5081. | avg_query_reads | OFF |
  5082. | avg_query_readkb | OFF |
  5083. | avg_query_readtime | OFF |
  5084. +--------------------+-------+
  5085. 29 rows in set (0.00 sec)
  5086. </pre><p>
  5087. </p><p>
  5088. Starting from version 2.1.1-beta, an optional LIKE clause is supported.
  5089. Refer to <a class="xref" href="#sphinxql-show-meta" title="8.3.&nbsp;SHOW META syntax">Section&nbsp;8.3, &#8220;SHOW META syntax&#8221;</a> for its syntax details.
  5090. </p></div>
  5091. <div class="sect1" title="8.6.&nbsp;INSERT and REPLACE syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-insert"></a>8.6.&nbsp;INSERT and REPLACE syntax</h2></div></div></div>
  5092. <pre class="programlisting">
  5093. {INSERT | REPLACE} INTO index [(column, ...)]
  5094. VALUES (value, ...)
  5095. [, (...)]
  5096. </pre><p>
  5097. INSERT statement, introduced in version 1.10-beta, is only supported for RT indexes.
  5098. It inserts new rows (documents) into an existing index, with the provided column values.
  5099. </p><p>
  5100. ID column must be present in all cases. Rows with duplicate IDs will <span class="bold"><strong>not</strong></span>
  5101. be overwritten by INSERT; use REPLACE to do that.
  5102. </p><p>
  5103. <code class="option">index</code> is the name of RT index into which the new row(s)
  5104. should be inserted. The optional column names list lets you only explicitly specify
  5105. values for some of the columns present in the index. All the other columns will be
  5106. filled with their default values (0 for scalar types, empty string for text types).
  5107. </p><p>
  5108. Expressions are not currently supported in INSERT and values should be explicitly
  5109. specified.
  5110. </p><p>
  5111. Multiple rows can be inserted using a single INSERT statement by providing
  5112. several comma-separated, parentheses-enclosed lists of rows values.
  5113. </p></div>
  5114. <div class="sect1" title="8.7.&nbsp;REPLACE syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-replace"></a>8.7.&nbsp;REPLACE syntax</h2></div></div></div>
  5115. <pre class="programlisting">
  5116. {INSERT | REPLACE} INTO index [(column, ...)]
  5117. VALUES (value, ...)
  5118. [, (...)]
  5119. </pre><p>
  5120. REPLACE syntax is identical to INSERT syntax and is discussed in <a class="xref" href="#sphinxql-insert" title="8.6.&nbsp;INSERT and REPLACE syntax">Section&nbsp;8.6, &#8220;INSERT and REPLACE syntax&#8221;</a>.
  5121. </p></div>
  5122. <div class="sect1" title="8.8.&nbsp;DELETE syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-delete"></a>8.8.&nbsp;DELETE syntax</h2></div></div></div>
  5123. <pre class="programlisting">
  5124. DELETE FROM index WHERE where_condition
  5125. </pre><p>
  5126. DELETE statement, introduced in version 1.10-beta, is only supported for RT indexes and for distributed which contains only RT indexes as agents
  5127. It deletes existing rows (documents) from an existing index based on ID.
  5128. </p><p>
  5129. <code class="option">index</code> is the name of RT index from which the row should be deleted.
  5130. </p><p>
  5131. <code class="code">where_condition</code> has the same syntax
  5132. as in the SELECT statement (see <a class="xref" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">Section&nbsp;8.1, &#8220;SELECT syntax&#8221;</a> for details).
  5133. </p><pre class="programlisting">
  5134. mysql&gt; select * from rt;
  5135. +------+------+-------------+------+
  5136. | id | gid | mva1 | mva2 |
  5137. +------+------+-------------+------+
  5138. | 100 | 1000 | 100,201 | 100 |
  5139. | 101 | 1001 | 101,202 | 101 |
  5140. | 102 | 1002 | 102,203 | 102 |
  5141. | 103 | 1003 | 103,204 | 103 |
  5142. | 104 | 1004 | 104,204,205 | 104 |
  5143. | 105 | 1005 | 105,206 | 105 |
  5144. | 106 | 1006 | 106,207 | 106 |
  5145. | 107 | 1007 | 107,208 | 107 |
  5146. +------+------+-------------+------+
  5147. 8 rows in set (0.00 sec)
  5148. mysql&gt; delete from rt where match ('dumy') and mva1&gt;206;
  5149. Query OK, 2 rows affected (0.00 sec)
  5150. mysql&gt; select * from rt;
  5151. +------+------+-------------+------+
  5152. | id | gid | mva1 | mva2 |
  5153. +------+------+-------------+------+
  5154. | 100 | 1000 | 100,201 | 100 |
  5155. | 101 | 1001 | 101,202 | 101 |
  5156. | 102 | 1002 | 102,203 | 102 |
  5157. | 103 | 1003 | 103,204 | 103 |
  5158. | 104 | 1004 | 104,204,205 | 104 |
  5159. | 105 | 1005 | 105,206 | 105 |
  5160. +------+------+-------------+------+
  5161. 6 rows in set (0.00 sec)
  5162. mysql&gt; delete from rt where id in (100,104,105);
  5163. Query OK, 3 rows affected (0.01 sec)
  5164. mysql&gt; select * from rt;
  5165. +------+------+---------+------+
  5166. | id | gid | mva1 | mva2 |
  5167. +------+------+---------+------+
  5168. | 101 | 1001 | 101,202 | 101 |
  5169. | 102 | 1002 | 102,203 | 102 |
  5170. | 103 | 1003 | 103,204 | 103 |
  5171. +------+------+---------+------+
  5172. 3 rows in set (0.00 sec)
  5173. mysql&gt; delete from rt where mva1 in (102,204);
  5174. Query OK, 2 rows affected (0.01 sec)
  5175. mysql&gt; select * from rt;
  5176. +------+------+---------+------+
  5177. | id | gid | mva1 | mva2 |
  5178. +------+------+---------+------+
  5179. | 101 | 1001 | 101,202 | 101 |
  5180. +------+------+---------+------+
  5181. 1 row in set (0.00 sec)
  5182. </pre></div>
  5183. <div class="sect1" title="8.9.&nbsp;SET syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-set"></a>8.9.&nbsp;SET syntax</h2></div></div></div>
  5184. <pre class="programlisting">
  5185. SET [GLOBAL] server_variable_name = value
  5186. SET [INDEX index_name] GLOBAL @user_variable_name = (int_val1 [, int_val2, ...])
  5187. SET NAMES value
  5188. SET @@dummy_variable = ignored_value
  5189. </pre><p>
  5190. SET statement, introduced in version 1.10-beta, modifies a variable value.
  5191. The variable names are case-insensitive. No variable value changes survive
  5192. server restart.
  5193. </p><p>
  5194. SET NAMES statement and SET @@variable_name syntax, both introduced
  5195. in version 2.0.2-beta, do nothing. They were implemented to maintain
  5196. compatibility with 3rd party MySQL client libraries, connectors,
  5197. and frameworks that may need to run this statement when connecting.
  5198. </p><p>
  5199. There are the following classes of the variables:
  5200. </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>per-session server variable (1.10-beta and above)</p></li>
  5201. <li class="listitem"><p>global server variable (2.0.1-beta and above)</p></li>
  5202. <li class="listitem"><p>global user variable (2.0.1-beta and above)</p></li>
  5203. <li class="listitem"><p>global distributed variable (2.2.3-beta and above)</p></li>
  5204. </ol></div>
  5205. <p>
  5206. </p><p>
  5207. Global user variables are shared between concurrent sessions. Currently,
  5208. the only supported value type is the list of BIGINTs, and these variables
  5209. can only be used along with IN() for filtering purpose. The intended usage
  5210. scenario is uploading huge lists of values to <code class="filename">searchd</code>
  5211. (once) and reusing them (many times) later, saving on network overheads.
  5212. Starting with 2.2.3-beta, global user variables might be either transferred to
  5213. all agents of distributed index or set locally in case of local index
  5214. defined at distibuted index. Example:
  5215. </p><pre class="programlisting">
  5216. // in session 1
  5217. mysql&gt; SET GLOBAL @myfilter=(2,3,5,7,11,13);
  5218. Query OK, 0 rows affected (0.00 sec)
  5219. // later in session 2
  5220. mysql&gt; SELECT * FROM test1 WHERE group_id IN @myfilter;
  5221. +------+--------+----------+------------+-----------------+------+
  5222. | id | weight | group_id | date_added | title | tag |
  5223. +------+--------+----------+------------+-----------------+------+
  5224. | 3 | 1 | 2 | 1299338153 | another doc | 15 |
  5225. | 4 | 1 | 2 | 1299338153 | doc number four | 7,40 |
  5226. +------+--------+----------+------------+-----------------+------+
  5227. 2 rows in set (0.02 sec)
  5228. </pre><p>
  5229. </p><p>
  5230. Per-session and global server variables affect certain server settings in the respective scope.
  5231. Known per-session server variables are:
  5232. </p><div class="variablelist"><dl><dt><span class="term"><code class="code">AUTOCOMMIT = {0 | 1}</code></span></dt>
  5233. <dd><p>
  5234. Whether any data modification statement should be implicitly
  5235. wrapped by BEGIN and COMMIT.
  5236. Introduced in version 1.10-beta.
  5237. </p></dd><dt><span class="term"><code class="code">COLLATION_CONNECTION = collation_name</code></span></dt>
  5238. <dd><p>
  5239. Selects the collation to be used for ORDER BY or GROUP BY on string
  5240. values in the subsequent queries. Refer to <a class="xref" href="#collations" title="5.12.&nbsp;Collations">Section&nbsp;5.12, &#8220;Collations&#8221;</a>
  5241. for a list of known collation names.
  5242. Introduced in version 2.0.1-beta.
  5243. </p></dd><dt><span class="term"><code class="code">CHARACTER_SET_RESULTS = charset_name</code></span></dt>
  5244. <dd><p>
  5245. Does nothing; a placeholder to support frameworks, clients, and
  5246. connectors that attempt to automatically enforce a charset when
  5247. connecting to a Sphinx server.
  5248. Introduced in version 2.0.1-beta.
  5249. </p></dd><dt><span class="term"><code class="code">SQL_AUTO_IS_NULL = value</code></span></dt>
  5250. <dd><p>
  5251. Does nothing; a placeholder to support frameworks, clients, and
  5252. connectors that attempt to automatically enforce a charset when
  5253. connecting to a Sphinx server.
  5254. Introduced in version 2.0.2-beta.
  5255. </p></dd><dt><span class="term"><code class="code">SQL_MODE = value</code></span></dt>
  5256. <dd><p>
  5257. Does nothing; a placeholder to support frameworks, clients, and
  5258. connectors that attempt to automatically enforce a charset when
  5259. connecting to a Sphinx server.
  5260. Introduced in version 2.0.2-beta.
  5261. </p></dd><dt><span class="term"><code class="code">PROFILING = {0 | 1}</code></span></dt>
  5262. <dd><p>
  5263. Enables query profiling in the current session. Defaults to 0.
  5264. See also <a class="xref" href="#sphinxql-show-profile" title="8.30.&nbsp;SHOW PROFILE syntax">Section&nbsp;8.30, &#8220;SHOW PROFILE syntax&#8221;</a>.
  5265. Introduced in version 2.1.1-beta.
  5266. </p></dd></dl></div>
  5267. <p>
  5268. </p><p>
  5269. Known global server variables are:
  5270. </p><div class="variablelist"><dl><dt><span class="term"><code class="code">QUERY_LOG_FORMAT = {plain | sphinxql}</code></span></dt>
  5271. <dd><p>
  5272. Changes the current log format.
  5273. Introduced in version 2.0.1-beta.
  5274. </p></dd><dt><span class="term"><code class="code">LOG_LEVEL = {info | debug | debugv | debugvv}</code></span></dt>
  5275. <dd><p>
  5276. Changes the current log verboseness level.
  5277. Introduced in version 2.0.1-beta.
  5278. </p></dd></dl></div>
  5279. <p>
  5280. </p><p>
  5281. Examples:
  5282. </p><pre class="programlisting">
  5283. mysql&gt; SET autocommit=0;
  5284. Query OK, 0 rows affected (0.00 sec)
  5285. mysql&gt; SET GLOBAL query_log_format=sphinxql;
  5286. Query OK, 0 rows affected (0.00 sec)
  5287. </pre><p>
  5288. </p></div>
  5289. <div class="sect1" title="8.10.&nbsp;SET TRANSACTION syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-set-transaction"></a>8.10.&nbsp;SET TRANSACTION syntax</h2></div></div></div>
  5290. <pre class="programlisting">
  5291. SET TRANSACTION ISOLATION LEVEL { READ UNCOMMITTED
  5292. | READ COMMITTED
  5293. | REPEATABLE READ
  5294. | SERIALIZABLE }
  5295. </pre><p>
  5296. SET TRANSACTION statement, introduced in version 2.0.2-beta, does nothing.
  5297. It was implemented to maintain compatibility with 3rd party MySQL client
  5298. libraries, connectors, and frameworks that may need to run this statement
  5299. when connecting.
  5300. </p><p>
  5301. Example:
  5302. </p><pre class="programlisting">
  5303. mysql&gt; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
  5304. Query OK, 0 rows affected (0.00 sec)
  5305. </pre><p>
  5306. </p></div>
  5307. <div class="sect1" title="8.11.&nbsp;BEGIN, COMMIT, and ROLLBACK syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-commit"></a>8.11.&nbsp;BEGIN, COMMIT, and ROLLBACK syntax</h2></div></div></div>
  5308. <pre class="programlisting">
  5309. START TRANSACTION | BEGIN
  5310. COMMIT
  5311. ROLLBACK
  5312. SET AUTOCOMMIT = {0 | 1}
  5313. </pre><p>
  5314. BEGIN, COMMIT, and ROLLBACK statements were introduced in version 1.10-beta.
  5315. BEGIN statement (or its START TRANSACTION alias) forcibly commits pending
  5316. transaction, if any, and begins a new one. COMMIT statement commits the current
  5317. transaction, making all its changes permanent. ROLLBACK statement rolls back the
  5318. current transaction, canceling all its changes. SET AUTOCOMMIT controls the
  5319. autocommit mode in the active session.
  5320. </p><p>
  5321. AUTOCOMMIT is set to 1 by default, meaning that every statement that performs
  5322. any changes on any index is implicitly wrapped in BEGIN and COMMIT.
  5323. </p><p>
  5324. Transactions are limited to a single RT index, and also limited in size.
  5325. They are atomic, consistent, overly isolated, and durable. Overly isolated
  5326. means that the changes are not only invisible to the concurrent transactions
  5327. but even to the current session itself.
  5328. </p></div>
  5329. <div class="sect1" title="8.12.&nbsp;BEGIN syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-begin"></a>8.12.&nbsp;BEGIN syntax</h2></div></div></div>
  5330. <pre class="programlisting">
  5331. START TRANSACTION | BEGIN
  5332. </pre><p>
  5333. BEGIN syntax is discussed in detail in <a class="xref" href="#sphinxql-commit" title="8.11.&nbsp;BEGIN, COMMIT, and ROLLBACK syntax">Section&nbsp;8.11, &#8220;BEGIN, COMMIT, and ROLLBACK syntax&#8221;</a>.
  5334. </p></div>
  5335. <div class="sect1" title="8.13.&nbsp;ROLLBACK syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-rollback"></a>8.13.&nbsp;ROLLBACK syntax</h2></div></div></div>
  5336. <pre class="programlisting">
  5337. ROLLBACK
  5338. </pre><p>
  5339. ROLLBACK syntax is discussed in detail in <a class="xref" href="#sphinxql-commit" title="8.11.&nbsp;BEGIN, COMMIT, and ROLLBACK syntax">Section&nbsp;8.11, &#8220;BEGIN, COMMIT, and ROLLBACK syntax&#8221;</a>.
  5340. </p></div>
  5341. <div class="sect1" title="8.14.&nbsp;CALL SNIPPETS syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-call-snippets"></a>8.14.&nbsp;CALL SNIPPETS syntax</h2></div></div></div>
  5342. <pre class="programlisting">
  5343. CALL SNIPPETS(data, index, query[, opt_value AS opt_name[, ...]])
  5344. </pre><p>
  5345. CALL SNIPPETS statement, introduced in version 1.10-beta, builds a snippet
  5346. from provided data and query, using specified index settings.
  5347. </p><p>
  5348. <code class="option">data</code> is the source data to extract a snippet from. It could be a single string,
  5349. or the list of the strings enclosed in curly brackets.
  5350. <code class="option">index</code> is the name of the index from which to take the text
  5351. processing settings. <code class="option">query</code> is the full-text query to build
  5352. snippets for. Additional options are documented in
  5353. <a class="xref" href="#api-func-buildexcerpts" title="9.7.1.&nbsp;BuildExcerpts">Section&nbsp;9.7.1, &#8220;BuildExcerpts&#8221;</a>. Usage example:
  5354. </p><pre class="programlisting">
  5355. CALL SNIPPETS('this is my document text', 'test1', 'hello world',
  5356. 5 AS around, 200 AS limit);
  5357. CALL SNIPPETS(('this is my document text','this is my another text'), 'test1', 'hello world',
  5358. 5 AS around, 200 AS limit);
  5359. CALL SNIPPETS(('data/doc1.txt','data/doc2.txt','/home/sphinx/doc3.txt'), 'test1', 'hello world',
  5360. 5 AS around, 200 AS limit, 1 AS load_files);
  5361. </pre></div>
  5362. <div class="sect1" title="8.15.&nbsp;CALL KEYWORDS syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-call-keywords"></a>8.15.&nbsp;CALL KEYWORDS syntax</h2></div></div></div>
  5363. <pre class="programlisting">
  5364. CALL KEYWORDS(text, index [, 1])
  5365. </pre><p>
  5366. CALL KEYWORDS statement, introduced in version 1.10-beta, splits text
  5367. into particular keywords. It returns tokenized and normalized forms
  5368. of the keywords, and, optionally, keyword statistics. Since version 2.2.2-beta
  5369. it also returns the position of each keyword in the query and all
  5370. forms of tokenized keywords in the case that lemmatizers were used.
  5371. </p><p>
  5372. <code class="option">text</code> is the text to break down to keywords.
  5373. <code class="option">index</code> is the name of the index from which to take the text
  5374. processing settings. <code class="option">hits</code> is an optional boolean parameter
  5375. that specifies whether to return document and hit occurrence statistics.
  5376. </p></div>
  5377. <div class="sect1" title="8.16.&nbsp;SHOW TABLES syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-show-tables"></a>8.16.&nbsp;SHOW TABLES syntax</h2></div></div></div>
  5378. <pre class="programlisting">
  5379. SHOW TABLES [ LIKE pattern ]
  5380. </pre><p>
  5381. SHOW TABLES statement, introduced in version 2.0.1-beta, enumerates
  5382. all currently active indexes along with their types. As of 2.0.1-beta,
  5383. existing index types are <code class="option">local</code>, <code class="option">distributed</code>,
  5384. and <code class="option">rt</code> respectively.
  5385. Example:
  5386. </p><pre class="programlisting">
  5387. mysql&gt; SHOW TABLES;
  5388. +-------+-------------+
  5389. | Index | Type |
  5390. +-------+-------------+
  5391. | dist1 | distributed |
  5392. | rt | rt |
  5393. | test1 | local |
  5394. | test2 | local |
  5395. +-------+-------------+
  5396. 4 rows in set (0.00 sec)
  5397. </pre><p>
  5398. </p><p>
  5399. Starting from version 2.1.1-beta, an optional LIKE clause is supported.
  5400. Refer to <a class="xref" href="#sphinxql-show-meta" title="8.3.&nbsp;SHOW META syntax">Section&nbsp;8.3, &#8220;SHOW META syntax&#8221;</a> for its syntax details.
  5401. </p><pre class="programlisting">
  5402. mysql&gt; SHOW TABLES LIKE '%4';
  5403. +-------+-------------+
  5404. | Index | Type |
  5405. +-------+-------------+
  5406. | dist4 | distributed |
  5407. +-------+-------------+
  5408. 1 row in set (0.00 sec)
  5409. </pre></div>
  5410. <div class="sect1" title="8.17.&nbsp;DESCRIBE syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-describe"></a>8.17.&nbsp;DESCRIBE syntax</h2></div></div></div>
  5411. <pre class="programlisting">
  5412. {DESC | DESCRIBE} index [ LIKE pattern ]
  5413. </pre><p>
  5414. DESCRIBE statement, introduced in version 2.0.1-beta, lists
  5415. index columns and their associated types. Columns are document ID,
  5416. full-text fields, and attributes. The order matches that in which
  5417. fields and attributes are expected by INSERT and REPLACE statements.
  5418. As of 2.0.1-beta, column types are <code class="option">field</code>,
  5419. <code class="option">integer</code>, <code class="option">timestamp</code>,
  5420. <code class="option">ordinal</code>, <code class="option">bool</code>,
  5421. <code class="option">float</code>, <code class="option">bigint</code>,
  5422. <code class="option">string</code>, and <code class="option">mva</code>.
  5423. ID column will be typed either <code class="option">integer</code>
  5424. or <code class="option">bigint</code> based on whether the binaries
  5425. were built with 32-bit or 64-bit document ID support.
  5426. Example:
  5427. </p><pre class="programlisting">
  5428. mysql&gt; DESC rt;
  5429. +---------+---------+
  5430. | Field | Type |
  5431. +---------+---------+
  5432. | id | integer |
  5433. | title | field |
  5434. | content | field |
  5435. | gid | integer |
  5436. +---------+---------+
  5437. 4 rows in set (0.00 sec)
  5438. </pre><p>
  5439. Starting from version 2.1.1-beta, an optional LIKE clause is supported.
  5440. Refer to <a class="xref" href="#sphinxql-show-meta" title="8.3.&nbsp;SHOW META syntax">Section&nbsp;8.3, &#8220;SHOW META syntax&#8221;</a> for its syntax details.
  5441. </p></div>
  5442. <div class="sect1" title="8.18.&nbsp;CREATE FUNCTION syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-create-function"></a>8.18.&nbsp;CREATE FUNCTION syntax</h2></div></div></div>
  5443. <pre class="programlisting">
  5444. CREATE FUNCTION udf_name
  5445. RETURNS {INT | BIGINT | FLOAT | STRING}
  5446. SONAME 'udf_lib_file'
  5447. </pre><p>
  5448. CREATE FUNCTION statement, introduced in version 2.0.1-beta,
  5449. installs a <a class="link" href="#sphinx-udfs" title="6.1.&nbsp;Sphinx UDFs (User Defined Functions)">user-defined function (UDF)</a>
  5450. with the given name and type from the given library file.
  5451. The library file must reside in a trusted
  5452. <a class="link" href="#conf-plugin-dir" title="12.4.31.&nbsp;plugin_dir">plugin_dir</a> directory.
  5453. On success, the function is available for use in all subsequent
  5454. queries that the server receives. Example:
  5455. </p><pre class="programlisting">
  5456. mysql&gt; CREATE FUNCTION avgmva RETURNS INT SONAME 'udfexample.dll';
  5457. Query OK, 0 rows affected (0.03 sec)
  5458. mysql&gt; SELECT *, AVGMVA(tag) AS q from test1;
  5459. +------+--------+---------+-----------+
  5460. | id | weight | tag | q |
  5461. +------+--------+---------+-----------+
  5462. | 1 | 1 | 1,3,5,7 | 4.000000 |
  5463. | 2 | 1 | 2,4,6 | 4.000000 |
  5464. | 3 | 1 | 15 | 15.000000 |
  5465. | 4 | 1 | 7,40 | 23.500000 |
  5466. +------+--------+---------+-----------+
  5467. </pre></div>
  5468. <div class="sect1" title="8.19.&nbsp;DROP FUNCTION syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-drop-function"></a>8.19.&nbsp;DROP FUNCTION syntax</h2></div></div></div>
  5469. <pre class="programlisting">
  5470. DROP FUNCTION udf_name
  5471. </pre><p>
  5472. DROP FUNCTION statement, introduced in version 2.0.1-beta,
  5473. deinstalls a <a class="link" href="#sphinx-udfs" title="6.1.&nbsp;Sphinx UDFs (User Defined Functions)">user-defined function (UDF)</a>
  5474. with the given name. On success, the function is no longer available
  5475. for use in subsequent queries. Pending concurrent queries will not be
  5476. affected and the library unload, if necessary, will be postponed
  5477. until those queries complete. Example:
  5478. </p><pre class="programlisting">
  5479. mysql&gt; DROP FUNCTION avgmva;
  5480. Query OK, 0 rows affected (0.00 sec)
  5481. </pre></div>
  5482. <div class="sect1" title="8.20.&nbsp;SHOW VARIABLES syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-show-variables"></a>8.20.&nbsp;SHOW VARIABLES syntax</h2></div></div></div>
  5483. <pre class="programlisting">
  5484. SHOW [{GLOBAL | SESSION}] VARIABLES [WHERE variable_name='xxx']
  5485. </pre><p><span class="bold"><strong>SHOW VARIABLES</strong></span> statement was added in version 2.0.1-beta
  5486. to improve compatibility with 3rd party MySQL connectors and frameworks
  5487. that automatically execute this statement. The WHERE option was added in
  5488. version 2.1.1-beta.
  5489. </p><p>
  5490. In version 2.0.1-beta, it did nothing.
  5491. </p><p>
  5492. Starting from version 2.0.2-beta, it returns the current values of
  5493. a few server-wide variables. Also, support for GLOBAL and SESSION clauses
  5494. was added.
  5495. </p><pre class="programlisting">
  5496. mysql&gt; SHOW GLOBAL VARIABLES;
  5497. +----------------------+----------+
  5498. | Variable_name | Value |
  5499. +----------------------+----------+
  5500. | autocommit | 1 |
  5501. | collation_connection | libc_ci |
  5502. | query_log_format | sphinxql |
  5503. | log_level | info |
  5504. +----------------------+----------+
  5505. 4 rows in set (0.00 sec)
  5506. </pre><p>
  5507. </p><p>
  5508. Starting from 2.1.1-beta, support for WHERE variable_name clause was added,
  5509. to help certain connectors.
  5510. </p><p>
  5511. </p></div>
  5512. <div class="sect1" title="8.21.&nbsp;SHOW COLLATION syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-show-collation"></a>8.21.&nbsp;SHOW COLLATION syntax</h2></div></div></div>
  5513. <pre class="programlisting">
  5514. SHOW COLLATION
  5515. </pre><p>
  5516. Added in version 2.0.1-beta, this is currently a placeholder
  5517. query that does nothing and reports success. That is in order
  5518. to keep compatibility with frameworks and connectors that
  5519. automatically execute this statement.
  5520. </p><pre class="programlisting">
  5521. mysql&gt; SHOW COLLATION;
  5522. Query OK, 0 rows affected (0.00 sec)
  5523. </pre></div>
  5524. <div class="sect1" title="8.22.&nbsp;SHOW CHARACTER SET syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-show-character-set"></a>8.22.&nbsp;SHOW CHARACTER SET syntax</h2></div></div></div>
  5525. <pre class="programlisting">
  5526. SHOW CHARACTER SET
  5527. </pre><p>
  5528. Added in version 2.1.1-beta, this is currently a placeholder
  5529. query that does nothing and reports that a UTF-8 character set
  5530. is available. It was added in order
  5531. to keep compatibility with frameworks and connectors that
  5532. automatically execute this statement.
  5533. </p><pre class="programlisting">
  5534. mysql&gt; SHOW CHARACTER SET;
  5535. +---------+---------------+-------------------+--------+
  5536. | Charset | Description | Default collation | Maxlen |
  5537. +---------+---------------+-------------------+--------+
  5538. | utf8 | UTF-8 Unicode | utf8_general_ci | 3 |
  5539. +---------+---------------+-------------------+--------+
  5540. 1 row in set (0.00 sec)
  5541. </pre></div>
  5542. <div class="sect1" title="8.23.&nbsp;UPDATE syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-update"></a>8.23.&nbsp;UPDATE syntax</h2></div></div></div>
  5543. <pre class="programlisting">
  5544. UPDATE index SET col1 = newval1 [, ...] WHERE where_condition [OPTION opt_name = opt_value [, ...]]
  5545. </pre><p>
  5546. UPDATE statement was added in version 2.0.1-beta. Multiple attributes
  5547. and values can be specified in a single statement. Both RT and disk indexes
  5548. are supported.
  5549. </p><p>
  5550. As of version 2.0.2-beta, all attributes types (int, bigint, float, MVA),
  5551. except for strings and JSON attributes, can be dynamically updated.
  5552. Previously, some of these types were not supported.
  5553. </p><p>
  5554. <code class="code">where_condition</code> (also added in 2.0.2-beta) has the same syntax
  5555. as in the SELECT statement (see <a class="xref" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">Section&nbsp;8.1, &#8220;SELECT syntax&#8221;</a> for details).
  5556. </p><p>
  5557. When assigning the out-of-range values to 32-bit attributes, they
  5558. will be trimmed to their lower 32 bits without a prompt. For example,
  5559. if you try to update the 32-bit unsigned int with a value of 4294967297,
  5560. the value of 1 will actually be stored, because the lower 32 bits of
  5561. 4294967297 (0x100000001 in hex) amount to 1 (0x00000001 in hex).
  5562. </p><p>
  5563. MVA values sets for updating (and also for INSERT or REPLACE, refer
  5564. to <a class="xref" href="#sphinxql-insert" title="8.6.&nbsp;INSERT and REPLACE syntax">Section&nbsp;8.6, &#8220;INSERT and REPLACE syntax&#8221;</a>) must be specified as comma-separated
  5565. lists in parentheses. To erase the MVA value, just assign () to it.
  5566. </p><p>
  5567. Starting from 2.2.1-beta version UPDATE can be used to update integer and float
  5568. values in JSON array. No strings, arrays and other types yet.
  5569. </p><pre class="programlisting">
  5570. mysql&gt; UPDATE myindex SET enabled=0 WHERE id=123;
  5571. Query OK, 1 rows affected (0.00 sec)
  5572. mysql&gt; UPDATE myindex
  5573. SET bigattr=-100000000000,
  5574. fattr=3465.23,
  5575. mvattr1=(3,6,4),
  5576. mvattr2=()
  5577. WHERE MATCH('hehe') AND enabled=1;
  5578. Query OK, 148 rows affected (0.01 sec)
  5579. </pre><p>OPTION clause. This is a Sphinx specific extension that
  5580. lets you control a number of per-update options. The syntax is:
  5581. </p><pre class="programlisting">
  5582. OPTION &lt;optionname&gt;=&lt;value&gt; [ , ... ]
  5583. </pre><p>
  5584. The list of allowed options are the same as for <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">SELECT</a> statement. Specifically for UPDATE
  5585. statement you can use these options:
  5586. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>'ignore_nonexistent_columns' - this option, added in version 2.1.1-beta, points that the update will silently
  5587. ignore any warnings about trying to update a column which is not exists in current index schema.
  5588. </p><p>'strict' - this option is used while updating JSON attributes. As of
  5589. 2.2.1-beta, it's possible to update just some types in JSON. And if you
  5590. try to update, for example, array type you'll get error with 'strict' option
  5591. on and warning otherwise.</p></li>
  5592. </ul></div>
  5593. <p>
  5594. </p></div>
  5595. <div class="sect1" title="8.24.&nbsp;ALTER syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-attach"></a>8.24.&nbsp;ALTER syntax</h2></div></div></div>
  5596. <pre class="programlisting">
  5597. ALTER TABLE index {ADD|DROP} COLUMN column_name [{INTEGER|BIGINT|FLOAT|BOOL|MULTI|MULTI64|JSON|STRING}]
  5598. </pre><p>
  5599. The ALTER statement was added in version 2.2.1-beta. As of 2.2.1-beta, it supports adding one
  5600. attribute at a time for both plain and RT indexes. The int, bigint, float, bool, multi-valued,
  5601. multi-valued 64bit, json and string attribute types are supported. Support for multi, multi64,
  5602. json and string attributes was added in 2.2.2-beta. As of 2.2.2-beta, you can add json and
  5603. string attributes, but you cannot modify their values. The ability to remove attributes was
  5604. added in 2.2.2-beta.
  5605. </p><p>
  5606. Implementation details. As of 2.2.1-beta, the querying of an index is
  5607. impossible (because of a write lock) while adding a column. This may change
  5608. in the future. The newly created attribute values are set to 0. ALTER will
  5609. not work for distributed indexes and indexes without any attributes.
  5610. DROP COLUMN will fail if an index has only one attribute.
  5611. </p><pre class="programlisting">
  5612. ALTER RTINDEX index RECONFIGURE
  5613. </pre><p>
  5614. As of 2.2.3-beta, ALTER can also reconfigure an existing RT index, so that
  5615. new tokenization, morphology, and other text processing settings from sphinx.conf
  5616. take effect on the newly INSERT-ed rows, while retaining the existing rows
  5617. as they were. Internally, it forcibly saves the current RAM chunk as a new
  5618. disk chunk, and adjusts the index header, so that the new rows are tokenized
  5619. using the new rules. Note that as the queries are currently parsed separately
  5620. for every disk chunk, this might result in warnings regarding the keyword sets
  5621. mismatch.
  5622. </p><pre class="programlisting">
  5623. mysql&gt; desc plain;
  5624. +------------+-----------+
  5625. | Field | Type |
  5626. +------------+-----------+
  5627. | id | bigint |
  5628. | text | field |
  5629. | group_id | uint |
  5630. | date_added | timestamp |
  5631. +------------+-----------+
  5632. 4 rows in set (0.01 sec)
  5633. mysql&gt; alter table plain add column test integer;
  5634. Query OK, 0 rows affected (0.04 sec)
  5635. mysql&gt; desc plain;
  5636. +------------+-----------+
  5637. | Field | Type |
  5638. +------------+-----------+
  5639. | id | bigint |
  5640. | text | field |
  5641. | group_id | uint |
  5642. | date_added | timestamp |
  5643. | test | uint |
  5644. +------------+-----------+
  5645. 5 rows in set (0.00 sec)
  5646. mysql&gt; alter table plain drop column group_id;
  5647. Query OK, 0 rows affected (0.01 sec)
  5648. mysql&gt; desc plain;
  5649. +------------+-----------+
  5650. | Field | Type |
  5651. +------------+-----------+
  5652. | id | bigint |
  5653. | text | field |
  5654. | date_added | timestamp |
  5655. | test | uint |
  5656. +------------+-----------+
  5657. 4 rows in set (0.00 sec)
  5658. </pre></div>
  5659. <div class="sect1" title="8.25.&nbsp;ATTACH INDEX syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-attach-index"></a>8.25.&nbsp;ATTACH INDEX syntax</h2></div></div></div>
  5660. <pre class="programlisting">
  5661. ATTACH INDEX diskindex TO RTINDEX rtindex
  5662. </pre><p>
  5663. ATTACH INDEX statement, added in version 2.0.2-beta, lets you move
  5664. data from a regular disk index to a RT index.
  5665. </p><p>
  5666. After a successful ATTACH, the data originally stored in the source
  5667. disk index becomes a part of the target RT index, and the source disk
  5668. index becomes unavailable (until the next rebuild). ATTACH does not
  5669. result in any index data changes. Basically, it just renames the files
  5670. (making the source index a new disk chunk of the target RT index),
  5671. and updates the metadata. So it is a generally quick operation
  5672. which might (frequently) complete as fast as under a second.
  5673. </p><p>
  5674. Note that when an index is attached to an empty RT index, the fields,
  5675. attributes, and text processing settings (tokenizer, wordforms, etc) from
  5676. the <span class="emphasis"><em>source</em></span> index are copied over and take effect.
  5677. The respective parts of the RT index definition from the configuration
  5678. file will be ignored.
  5679. </p><p>
  5680. As of 2.0.2-beta, ATTACH INDEX comes with a number of restrictions.
  5681. Most notably, the target RT index is currently required to be empty,
  5682. making ATTACH INDEX a one-time conversion operation only. Those restrictions
  5683. may be lifted in future releases, as we add the needed functionality to the
  5684. RT indexes. The complete list is as follows.
  5685. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Target RT index needs to be empty. (See <a class="xref" href="#sphinxql-truncate-rtindex" title="8.28.&nbsp;TRUNCATE RTINDEX syntax">Section&nbsp;8.28, &#8220;TRUNCATE RTINDEX syntax&#8221;</a>)</p></li>
  5686. <li class="listitem"><p>Source disk index needs to have index_sp=0, boundary_step=0, stopword_step=1.</p></li>
  5687. <li class="listitem"><p>Source disk index needs to have an empty index_zones setting.</p></li>
  5688. </ul></div>
  5689. <p>
  5690. </p><pre class="programlisting">
  5691. mysql&gt; DESC rt;
  5692. +-----------+---------+
  5693. | Field | Type |
  5694. +-----------+---------+
  5695. | id | integer |
  5696. | testfield | field |
  5697. | testattr | uint |
  5698. +-----------+---------+
  5699. 3 rows in set (0.00 sec)
  5700. mysql&gt; SELECT * FROM rt;
  5701. Empty set (0.00 sec)
  5702. mysql&gt; SELECT * FROM disk WHERE MATCH('test');
  5703. +------+--------+----------+------------+
  5704. | id | weight | group_id | date_added |
  5705. +------+--------+----------+------------+
  5706. | 1 | 1304 | 1 | 1313643256 |
  5707. | 2 | 1304 | 1 | 1313643256 |
  5708. | 3 | 1304 | 1 | 1313643256 |
  5709. | 4 | 1304 | 1 | 1313643256 |
  5710. +------+--------+----------+------------+
  5711. 4 rows in set (0.00 sec)
  5712. mysql&gt; ATTACH INDEX disk TO RTINDEX rt;
  5713. Query OK, 0 rows affected (0.00 sec)
  5714. mysql&gt; DESC rt;
  5715. +------------+-----------+
  5716. | Field | Type |
  5717. +------------+-----------+
  5718. | id | integer |
  5719. | title | field |
  5720. | content | field |
  5721. | group_id | uint |
  5722. | date_added | timestamp |
  5723. +------------+-----------+
  5724. 5 rows in set (0.00 sec)
  5725. mysql&gt; SELECT * FROM rt WHERE MATCH('test');
  5726. +------+--------+----------+------------+
  5727. | id | weight | group_id | date_added |
  5728. +------+--------+----------+------------+
  5729. | 1 | 1304 | 1 | 1313643256 |
  5730. | 2 | 1304 | 1 | 1313643256 |
  5731. | 3 | 1304 | 1 | 1313643256 |
  5732. | 4 | 1304 | 1 | 1313643256 |
  5733. +------+--------+----------+------------+
  5734. 4 rows in set (0.00 sec)
  5735. mysql&gt; SELECT * FROM disk WHERE MATCH('test');
  5736. ERROR 1064 (42000): no enabled local indexes to search
  5737. </pre></div>
  5738. <div class="sect1" title="8.26.&nbsp;FLUSH RTINDEX syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-flush-rtindex"></a>8.26.&nbsp;FLUSH RTINDEX syntax</h2></div></div></div>
  5739. <pre class="programlisting">
  5740. FLUSH RTINDEX rtindex
  5741. </pre><p>
  5742. FLUSH RTINDEX statement, added in version 2.0.2-beta, forcibly
  5743. flushes RT index RAM chunk contents to disk.
  5744. </p><p>
  5745. Backing up a RT index is as simple as copying over its data files,
  5746. followed by the binary log. However, recovering from that backup means
  5747. that all the transactions in the log since the last successful RAM chunk
  5748. write would need to be replayed. Those writes normally happen either
  5749. on a clean shutdown, or periodically with a (big enough!) interval
  5750. between writes specified in
  5751. <a class="link" href="#conf-rt-flush-period" title="12.4.33.&nbsp;rt_flush_period">rt_flush_period</a> directive.
  5752. So such a backup made at an arbitrary point in time just might end up
  5753. with way too much binary log data to replay.
  5754. </p><p>
  5755. FLUSH RTINDEX forcibly writes the RAM chunk contents to disk,
  5756. and also causes the subsequent cleanup of (now-redundant) binary
  5757. log files. Thus, recovering from a backup made just after
  5758. FLUSH RTINDEX should be almost instant.
  5759. </p><pre class="programlisting">
  5760. mysql&gt; FLUSH RTINDEX rt;
  5761. Query OK, 0 rows affected (0.05 sec)
  5762. </pre></div>
  5763. <div class="sect1" title="8.27.&nbsp;FLUSH RAMCHUNK syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-flush-ramchunk"></a>8.27.&nbsp;FLUSH RAMCHUNK syntax</h2></div></div></div>
  5764. <pre class="programlisting">
  5765. FLUSH RAMCHUNK rtindex
  5766. </pre><p>
  5767. FLUSH RAMCHUNK statement, added in version 2.1.2-release, forcibly
  5768. creates a new disk chunk in a RT index.
  5769. </p><p>
  5770. Normally, RT index would flush and convert the contents of the
  5771. RAM chunk into a new disk chunk automatically, once the RAM chunk
  5772. reaches the maximum allowed
  5773. <a class="link" href="#conf-rt-mem-limit" title="12.2.49.&nbsp;rt_mem_limit">rt_mem_limit</a> size.
  5774. However, for debugging and testing it might be useful to forcibly
  5775. create a new disk chunk, and FLUSH RAMCHUNK statement does exactly that.
  5776. </p><p>
  5777. Note that using FLUSH RAMCHUNK increases RT index fragmentation.
  5778. Most likely, you want to use FLUSH RTINDEX instead. We suggest that
  5779. you abstain from using this statement unless you're absolutely sure
  5780. what you're doing.
  5781. </p><pre class="programlisting">
  5782. mysql&gt; FLUSH RAMCHUNK rt;
  5783. Query OK, 0 rows affected (0.05 sec)
  5784. </pre></div>
  5785. <div class="sect1" title="8.28.&nbsp;TRUNCATE RTINDEX syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-truncate-rtindex"></a>8.28.&nbsp;TRUNCATE RTINDEX syntax</h2></div></div></div>
  5786. <pre class="programlisting">
  5787. TRUNCATE RTINDEX rtindex
  5788. </pre><p>
  5789. TRUNCATE RTINDEX statement, added in version 2.1.1-beta, clears
  5790. the RT index completely. It disposes the in-memory data, unlinks
  5791. all the index data files, and releases the associated binary logs.
  5792. </p><pre class="programlisting">
  5793. mysql&gt; TRUNCATE RTINDEX rt;
  5794. Query OK, 0 rows affected (0.05 sec)
  5795. </pre><p>
  5796. You may want to use this if you are using RT indices as "delta index" files; when
  5797. you build the main index, you need to wipe the delta index, and thus TRUNCATE RTINDEX.
  5798. You also need to use this command before attaching an index; see <a class="xref" href="#sphinxql-attach-index" title="8.25.&nbsp;ATTACH INDEX syntax">Section&nbsp;8.25, &#8220;ATTACH INDEX syntax&#8221;</a>.
  5799. </p></div>
  5800. <div class="sect1" title="8.29.&nbsp;SHOW AGENT STATUS"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-show-agent-status"></a>8.29.&nbsp;SHOW AGENT STATUS</h2></div></div></div>
  5801. <pre class="programlisting">
  5802. SHOW AGENT ['agent'|'index'|index] STATUS [ LIKE pattern ]
  5803. </pre><p>
  5804. Displays the statistic of <a class="link" href="#conf-agent" title="12.2.31.&nbsp;agent">remote
  5805. agents</a> or distributed index. It includes the values like the age of the last
  5806. request, last answer, the number of different kind of errors and
  5807. successes, etc. The statistic is shown for every agent for last 1, 5
  5808. and 15 intervals, each of them of <a class="link" href="#conf-ha-period-karma" title="12.4.40.&nbsp;ha_period_karma">ha_period_karma</a> seconds.
  5809. The command exists only in sphinxql.
  5810. </p><pre class="programlisting">
  5811. mysql&gt; SHOW AGENT STATUS;
  5812. +------------------------------------+----------------------------+
  5813. | Key | Value |
  5814. +------------------------------------+----------------------------+
  5815. | status_period_seconds | 60 |
  5816. | status_stored_periods | 15 |
  5817. | ag_0_hostname | 192.168.0.202:6713 |
  5818. | ag_0_references | 2 |
  5819. | ag_0_lastquery | 0.41 |
  5820. | ag_0_lastanswer | 0.19 |
  5821. | ag_0_lastperiodmsec | 222 |
  5822. | ag_0_errorsarow | 0 |
  5823. | ag_0_1periods_query_timeouts | 0 |
  5824. | ag_0_1periods_connect_timeouts | 0 |
  5825. | ag_0_1periods_connect_failures | 0 |
  5826. | ag_0_1periods_network_errors | 0 |
  5827. | ag_0_1periods_wrong_replies | 0 |
  5828. | ag_0_1periods_unexpected_closings | 0 |
  5829. | ag_0_1periods_warnings | 0 |
  5830. | ag_0_1periods_succeeded_queries | 27 |
  5831. | ag_0_1periods_msecsperquery | 232.31 |
  5832. | ag_0_5periods_query_timeouts | 0 |
  5833. | ag_0_5periods_connect_timeouts | 0 |
  5834. | ag_0_5periods_connect_failures | 0 |
  5835. | ag_0_5periods_network_errors | 0 |
  5836. | ag_0_5periods_wrong_replies | 0 |
  5837. | ag_0_5periods_unexpected_closings | 0 |
  5838. | ag_0_5periods_warnings | 0 |
  5839. | ag_0_5periods_succeeded_queries | 146 |
  5840. | ag_0_5periods_msecsperquery | 231.83 |
  5841. | ag_1_hostname | 192.168.0.202:6714 |
  5842. | ag_1_references | 2 |
  5843. | ag_1_lastquery | 0.41 |
  5844. | ag_1_lastanswer | 0.19 |
  5845. | ag_1_lastperiodmsec | 220 |
  5846. | ag_1_errorsarow | 0 |
  5847. | ag_1_1periods_query_timeouts | 0 |
  5848. | ag_1_1periods_connect_timeouts | 0 |
  5849. | ag_1_1periods_connect_failures | 0 |
  5850. | ag_1_1periods_network_errors | 0 |
  5851. | ag_1_1periods_wrong_replies | 0 |
  5852. | ag_1_1periods_unexpected_closings | 0 |
  5853. | ag_1_1periods_warnings | 0 |
  5854. | ag_1_1periods_succeeded_queries | 27 |
  5855. | ag_1_1periods_msecsperquery | 231.24 |
  5856. | ag_1_5periods_query_timeouts | 0 |
  5857. | ag_1_5periods_connect_timeouts | 0 |
  5858. | ag_1_5periods_connect_failures | 0 |
  5859. | ag_1_5periods_network_errors | 0 |
  5860. | ag_1_5periods_wrong_replies | 0 |
  5861. | ag_1_5periods_unexpected_closings | 0 |
  5862. | ag_1_5periods_warnings | 0 |
  5863. | ag_1_5periods_succeeded_queries | 146 |
  5864. | ag_1_5periods_msecsperquery | 230.85 |
  5865. +------------------------------------+----------------------------+
  5866. 50 rows in set (0.01 sec)
  5867. </pre><p>
  5868. Starting from version 2.1.1-beta, an optional LIKE clause is supported.
  5869. Refer to <a class="xref" href="#sphinxql-show-meta" title="8.3.&nbsp;SHOW META syntax">Section&nbsp;8.3, &#8220;SHOW META syntax&#8221;</a> for its syntax details.
  5870. </p><pre class="programlisting">
  5871. mysql&gt; SHOW AGENT STATUS LIKE '%5period%msec%';
  5872. +-----------------------------+--------+
  5873. | Key | Value |
  5874. +-----------------------------+--------+
  5875. | ag_0_5periods_msecsperquery | 234.72 |
  5876. | ag_1_5periods_msecsperquery | 233.73 |
  5877. | ag_2_5periods_msecsperquery | 343.81 |
  5878. +-----------------------------+--------+
  5879. 3 rows in set (0.00 sec)
  5880. </pre><p>
  5881. You can specify a particular agent by its address. In this case only
  5882. that agent's data will be displayed. Also, 'agent_' prefix will be used
  5883. instead of 'ag_N_':
  5884. </p><pre class="programlisting">
  5885. mysql&gt; SHOW AGENT '192.168.0.202:6714' STATUS LIKE '%15periods%';
  5886. +-------------------------------------+--------+
  5887. | Variable_name | Value |
  5888. +-------------------------------------+--------+
  5889. | agent_15periods_query_timeouts | 0 |
  5890. | agent_15periods_connect_timeouts | 0 |
  5891. | agent_15periods_connect_failures | 0 |
  5892. | agent_15periods_network_errors | 0 |
  5893. | agent_15periods_wrong_replies | 0 |
  5894. | agent_15periods_unexpected_closings | 0 |
  5895. | agent_15periods_warnings | 0 |
  5896. | agent_15periods_succeeded_queries | 439 |
  5897. | agent_15periods_msecsperquery | 231.73 |
  5898. +-------------------------------------+--------+
  5899. 9 rows in set (0.00 sec)
  5900. </pre><p>Finally, you can check the status of the agents in a specific
  5901. distributed index. It can be done with a SHOW AGENT index STATUS statement.
  5902. That statement shows the index HA status (ie. whether or not it uses
  5903. agent mirrors at all), and then the mirror information (specifically:
  5904. address, blackhole and persistent flags, and the mirror selection
  5905. probability used when one of the
  5906. <a class="link" href="#conf-ha-strategy" title="12.2.60.&nbsp;ha_strategy">weighted-probability strategies</a>
  5907. is in effect).
  5908. </p><pre class="programlisting">
  5909. mysql&gt; SHOW AGENT dist_index STATUS;
  5910. +--------------------------------------+--------------------------------+
  5911. | Variable_name | Value |
  5912. +--------------------------------------+--------------------------------+
  5913. | dstindex_1_is_ha | 1 |
  5914. | dstindex_1mirror1_id | 192.168.0.202:6713:loc |
  5915. | dstindex_1mirror1_probability_weight | 0.372864 |
  5916. | dstindex_1mirror1_is_blackhole | 0 |
  5917. | dstindex_1mirror1_is_persistent | 0 |
  5918. | dstindex_1mirror2_id | 192.168.0.202:6714:loc |
  5919. | dstindex_1mirror2_probability_weight | 0.374635 |
  5920. | dstindex_1mirror2_is_blackhole | 0 |
  5921. | dstindex_1mirror2_is_persistent | 0 |
  5922. | dstindex_1mirror3_id | dev1.sphinxsearch.com:6714:loc |
  5923. | dstindex_1mirror3_probability_weight | 0.252501 |
  5924. | dstindex_1mirror3_is_blackhole | 0 |
  5925. | dstindex_1mirror3_is_persistent | 0 |
  5926. +--------------------------------------+--------------------------------+
  5927. 13 rows in set (0.00 sec)
  5928. </pre></div>
  5929. <div class="sect1" title="8.30.&nbsp;SHOW PROFILE syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-show-profile"></a>8.30.&nbsp;SHOW PROFILE syntax</h2></div></div></div>
  5930. <pre class="programlisting">
  5931. SHOW PROFILE
  5932. </pre><p>
  5933. SHOW PROFILE statement, added in version 2.1.1-beta, shows a detailed
  5934. execution profile of the previous SQL statement executed in the current
  5935. SphinxQL session. Also, profiling must be enabled in the current session
  5936. <span class="bold"><strong>before</strong></span> running the statement to be instrumented. That can be done
  5937. with a <code class="code">SET profiling=1</code> statement. By default, profiling
  5938. is disabled to avoid potential performance implications, and therefore
  5939. the profile will be empty.
  5940. </p><p>
  5941. Here's a complete instrumentation example:
  5942. </p><pre class="programlisting">
  5943. mysql&gt; SET profiling=1;
  5944. Query OK, 0 rows affected (0.00 sec)
  5945. mysql&gt; SELECT id FROM lj WHERE MATCH('the test') LIMIT 1;
  5946. +--------+
  5947. | id |
  5948. +--------+
  5949. | 946418 |
  5950. +--------+
  5951. 1 row in set (0.05 sec)
  5952. mysql&gt; SHOW PROFILE;
  5953. +--------------+----------+----------+
  5954. | Status | Duration | Switches |
  5955. +--------------+----------+----------+
  5956. | unknown | 0.000610 | 6 |
  5957. | net_read | 0.000007 | 1 |
  5958. | dist_connect | 0.000036 | 1 |
  5959. | sql_parse | 0.000048 | 1 |
  5960. | dict_setup | 0.000001 | 1 |
  5961. | parse | 0.000023 | 1 |
  5962. | transforms | 0.000002 | 1 |
  5963. | init | 0.000401 | 3 |
  5964. | open | 0.000104 | 1 |
  5965. | read_docs | 0.001570 | 71 |
  5966. | read_hits | 0.003936 | 222 |
  5967. | get_docs | 0.029837 | 1347 |
  5968. | get_hits | 0.000548 | 1433 |
  5969. | filter | 0.000619 | 1274 |
  5970. | rank | 0.009892 | 2909 |
  5971. | sort | 0.001562 | 52 |
  5972. | finalize | 0.000250 | 1 |
  5973. | dist_wait | 0.000000 | 1 |
  5974. | aggregate | 0.000145 | 1 |
  5975. | net_write | 0.000031 | 1 |
  5976. +--------------+----------+----------+
  5977. 20 rows in set (0.00 sec)
  5978. </pre><p>
  5979. </p><p>
  5980. Status column briefly describes where exactly (in which state)
  5981. was the time spent. Duration column shows the wall clock time,
  5982. in seconds. Switches column displays the number of times query
  5983. engine changed to the given state. Those are just logical engine
  5984. state switches and <span class="bold"><strong>not</strong></span> any OS level context switches nor
  5985. function calls (even though some of the sections can actually map
  5986. to function calls) and they do <span class="bold"><strong>not</strong></span> have any direct effect
  5987. on the performance. In a sense, number of switches is just a number
  5988. of times when the respective instrumentation point was hit.
  5989. </p><p>
  5990. States in the profile are returned in a prerecorded order
  5991. that roughly maps (but is <span class="bold"><strong>not</strong></span> identical) to the actual
  5992. query order.
  5993. </p><p>
  5994. A list of states may (and will) vary over time, as we refine
  5995. the states. Here's a brief description of the currently profiled
  5996. states.
  5997. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><span class="bold"><strong>unknown</strong></span>, generic catch-all state. Accounts for both
  5998. not-yet-instrumented code, or just small miscellaneous tasks that do not
  5999. really belong in any other state, but are too small to deserve their own state.
  6000. </li>
  6001. <li class="listitem"><span class="bold"><strong>net_read</strong></span>, reading the query from the network (that is, the application).</li>
  6002. <li class="listitem"><span class="bold"><strong>io</strong></span>, generic file IO time.</li>
  6003. <li class="listitem"><span class="bold"><strong>dist_connect</strong></span>, connecting to remote agents in the distributed index case.</li>
  6004. <li class="listitem"><span class="bold"><strong>sql_parse</strong></span>, parsing the SphinxQL syntax.</li>
  6005. <li class="listitem"><span class="bold"><strong>dict_setup</strong></span>, dictionary and tokenizer setup.</li>
  6006. <li class="listitem"><span class="bold"><strong>parse</strong></span>, parsing the full-text query syntax.</li>
  6007. <li class="listitem"><span class="bold"><strong>transforms</strong></span>, full-text query transformations (wildcard and other expansions, simplification, etc).</li>
  6008. <li class="listitem"><span class="bold"><strong>init</strong></span>, initializing the query evaluation.</li>
  6009. <li class="listitem"><span class="bold"><strong>open</strong></span>, opening the index files.</li>
  6010. <li class="listitem"><span class="bold"><strong>read_docs</strong></span>, IO time spent reading document lists.</li>
  6011. <li class="listitem"><span class="bold"><strong>read_hits</strong></span>, IO time spent reading keyword positions.</li>
  6012. <li class="listitem"><span class="bold"><strong>get_docs</strong></span>, computing the matching documents.</li>
  6013. <li class="listitem"><span class="bold"><strong>get_hits</strong></span>, computing the matching positions.</li>
  6014. <li class="listitem"><span class="bold"><strong>filter</strong></span>, filtering the full-text matches.</li>
  6015. <li class="listitem"><span class="bold"><strong>rank</strong></span>, computing the relevance rank.</li>
  6016. <li class="listitem"><span class="bold"><strong>sort</strong></span>, sorting the matches.</li>
  6017. <li class="listitem"><span class="bold"><strong>finalize</strong></span>, finalizing the per-index search result set (last stage expressions, etc).</li>
  6018. <li class="listitem"><span class="bold"><strong>dist_wait</strong></span>, waiting for the remote results from the agents in the distributed index case.</li>
  6019. <li class="listitem"><span class="bold"><strong>aggregate</strong></span>, aggregating multiple result sets.</li>
  6020. <li class="listitem"><span class="bold"><strong>net_write</strong></span>, writing the result set to the network.</li>
  6021. </ul></div>
  6022. <p>
  6023. </p></div>
  6024. <div class="sect1" title="8.31.&nbsp;SHOW INDEX STATUS syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-show-index-status"></a>8.31.&nbsp;SHOW INDEX STATUS syntax</h2></div></div></div>
  6025. <pre class="programlisting">
  6026. SHOW INDEX index_name STATUS
  6027. </pre><p>
  6028. Added in version 2.1.1-beta. Displays various per-index statistics. Currently,
  6029. those include:
  6030. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><span class="bold"><strong>indexed_documents</strong></span> and <span class="bold"><strong>indexed_bytes</strong></span>, number of
  6031. the documents indexed and their text size in bytes, respectively.</li>
  6032. <li class="listitem"><span class="bold"><strong>field_tokens_XXX</strong></span>, sums of per-field lengths (in tokens)
  6033. over the entire index (that is used internally in BM25A and BM25F functions
  6034. for ranking purposes). Only available for indexes built with index_field_lengths=1.</li>
  6035. <li class="listitem"><span class="bold"><strong>ram_bytes</strong></span>, total size (in bytes) of the RAM-resident
  6036. index portion.
  6037. </li>
  6038. </ul></div>
  6039. <p>
  6040. </p><pre class="programlisting">
  6041. mysql&gt; SHOW INDEX lj STATUS;
  6042. +--------------------+-------------+
  6043. | Variable_name | Value |
  6044. +--------------------+-------------+
  6045. | index_type | disk |
  6046. | indexed_documents | 2495219 |
  6047. | indexed_bytes | 10380483879 |
  6048. | field_tokens_title | 6999145 |
  6049. | field_tokens_body | 1501825050 |
  6050. | total_tokens | 1508824195 |
  6051. | ram_bytes | 305963599 |
  6052. | disk_bytes | 5455804365 |
  6053. | mem_limit | 536870912 |
  6054. +--------------------+-------------+
  6055. 8 rows in set (0.00 sec)
  6056. </pre></div>
  6057. <div class="sect1" title="8.32.&nbsp;SHOW INDEX SETTINGS syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-show-index-settings"></a>8.32.&nbsp;SHOW INDEX SETTINGS syntax</h2></div></div></div>
  6058. <pre class="programlisting">
  6059. SHOW INDEX index_name[.N | CHUNK N] SETTINGS
  6060. </pre><p>
  6061. Displays per-index settings in a <code class="filename">sphinx.conf</code> compliant
  6062. file format, similar to the <a class="link" href="#ref-indextool" title="7.4.&nbsp;indextool command reference">--dumpconfig</a>
  6063. option of the indextool. The report provides a breakdown of all the index
  6064. settings, including tokenizer and dictionary options. You may also specify
  6065. a particular <a class="link" href="#conf-rt-mem-limit" title="12.2.49.&nbsp;rt_mem_limit">chunk number</a>
  6066. for the RT indexes.
  6067. </p></div>
  6068. <div class="sect1" title="8.33.&nbsp;OPTIMIZE INDEX syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-optimize-index"></a>8.33.&nbsp;OPTIMIZE INDEX syntax</h2></div></div></div>
  6069. <pre class="programlisting">
  6070. OPTIMIZE INDEX index_name
  6071. </pre><p>
  6072. Available since version 2.1.1-beta, OPTIMIZE statement enqueues
  6073. a RT index for optimization in a background thread.
  6074. </p><p>
  6075. Over time, RT indexes can grow fragmented into many disk chunks
  6076. and/or tainted with deleted, but unpurged data, impacting search
  6077. performance. When that happens, they can be optimized. Basically,
  6078. the optimization pass merges together disk chunks pairs, purging
  6079. off documents suppressed by K-list as it goes.
  6080. </p><p>
  6081. That is a lengthy and IO intensive process, so to limit the
  6082. impact, all the actual merge work is executed serially in
  6083. a special background thread, and the OPTIMIZE statement simply
  6084. adds a job to its queue. Currently, there is no way to check
  6085. the index or queue status (that might be added in the future
  6086. to the SHOW INDEX STATUS and SHOW STATUS statements respectively).
  6087. The optimization thread can be IO-throttled, you can control the
  6088. maximum number of IOs per second and the maximum IO size
  6089. with <a class="link" href="#conf-rt-merge-iops" title="12.4.42.&nbsp;rt_merge_iops">rt_merge_iops</a>
  6090. and <a class="link" href="#conf-rt-merge-maxiosize" title="12.4.43.&nbsp;rt_merge_maxiosize">rt_merge_maxiosize</a>
  6091. directives respectively. The optimization jobs queue is lost
  6092. on daemon crash.
  6093. </p><p>
  6094. The RT index being optimized stays online and available
  6095. for both searching and updates at (almost) all times during
  6096. the optimization. It gets locked (very) briefly every time
  6097. that a pair of disk chunks is merged successfully, to rename
  6098. the old and the new files, and update the index header.
  6099. </p><p>
  6100. At the moment, OPTIMIZE needs to be issued manually,
  6101. the indexes will <span class="emphasis"><em>not</em></span> be optimized
  6102. automatically. That might change in the future releases.
  6103. </p><pre class="programlisting">
  6104. mysql&gt; OPTIMIZE INDEX rt;
  6105. Query OK, 0 rows affected (0.00 sec)
  6106. </pre></div>
  6107. <div class="sect1" title="8.34.&nbsp;SHOW PLAN syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-show-plan"></a>8.34.&nbsp;SHOW PLAN syntax</h2></div></div></div>
  6108. <pre class="programlisting">
  6109. SHOW PLAN
  6110. </pre><p>
  6111. SHOW PLAN statement, added in 2.1.2-release, displays the execution plan
  6112. of the previous SELECT statement. The plan gets generated and stored
  6113. during the actual execution, so profiling must be enabled in the current
  6114. session <span class="bold"><strong>before</strong></span> running that statement. That can be done
  6115. with a <code class="code">SET profiling=1</code> statement.
  6116. </p><p>
  6117. Here's a complete instrumentation example:
  6118. </p><pre class="programlisting">
  6119. mysql&gt; SET profiling=1 \G
  6120. Query OK, 0 rows affected (0.00 sec)
  6121. mysql&gt; SELECT id FROM lj WHERE MATCH('the i') LIMIT 1 \G
  6122. *************************** 1. row ***************************
  6123. id: 39815
  6124. 1 row in set (1.53 sec)
  6125. mysql&gt; SHOW PLAN \G
  6126. *************************** 1. row ***************************
  6127. Variable: transformed_tree
  6128. Value: AND(
  6129. AND(KEYWORD(the, querypos=1)),
  6130. AND(KEYWORD(i, querypos=2)))
  6131. 1 row in set (0.00 sec)
  6132. </pre><p>
  6133. And here's a less trivial example that shows how the actually
  6134. evaluated query tree can be rather different from the original one
  6135. because of expansions and other transformations:
  6136. </p><pre class="programlisting">
  6137. mysql&gt; SELECT * FROM test WHERE MATCH('@title abc* @body hey') \G SHOW PLAN \G
  6138. ...
  6139. *************************** 1. row ***************************
  6140. Variable: transformed_tree
  6141. Value: AND(
  6142. OR(fields=(title), KEYWORD(abcx, querypos=1, expanded), KEYWORD(abcm, querypos=1, expanded)),
  6143. AND(fields=(body), KEYWORD(hey, querypos=2)))
  6144. 1 row in set (0.00 sec)
  6145. </pre><p>
  6146. </p></div>
  6147. <div class="sect1" title="8.35.&nbsp;SHOW DATABASES syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-show-databases"></a>8.35.&nbsp;SHOW DATABASES syntax</h2></div></div></div>
  6148. <pre class="programlisting">
  6149. SHOW DATABASES
  6150. </pre><p>
  6151. Added in 2.2.1-beta. This is a dummy statement to support MySQL Workbench
  6152. and other clients that require it. Currently, it does absolutely nothing.
  6153. </p></div>
  6154. <div class="sect1" title="8.36.&nbsp;CREATE PLUGIN syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-create-plugin"></a>8.36.&nbsp;CREATE PLUGIN syntax</h2></div></div></div>
  6155. <pre class="programlisting">
  6156. CREATE PLUGIN plugin_name TYPE 'plugin_type' SONAME 'plugin_library'
  6157. </pre><p>
  6158. Added in 2.2.2-beta. Loads the given library (if it is not loaded yet) and loads
  6159. the specified plugin from it. As of 2.2.2-beta, the known plugin types are:
  6160. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>ranker</p></li>
  6161. <li class="listitem"><p>index_token_filter</p></li>
  6162. <li class="listitem"><p>query_token_filter</p></li>
  6163. </ul></div>
  6164. <p>
  6165. Refer to <a class="xref" href="#sphinx-plugins" title="6.2.&nbsp;Sphinx plugins">Section&nbsp;6.2, &#8220;Sphinx plugins&#8221;</a> for more information regarding
  6166. writing the plugins.
  6167. </p><pre class="programlisting">
  6168. mysql&gt; CREATE PLUGIN myranker TYPE 'ranker' SONAME 'myplugins.so';
  6169. Query OK, 0 rows affected (0.00 sec)
  6170. </pre></div>
  6171. <div class="sect1" title="8.37.&nbsp;DROP PLUGIN syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-drop-plugin"></a>8.37.&nbsp;DROP PLUGIN syntax</h2></div></div></div>
  6172. <pre class="programlisting">
  6173. DROP PLUGIN plugin_name TYPE 'plugin_type'
  6174. </pre><p>
  6175. Added in 2.2.2-beta. Markes the specified plugin for unloading.
  6176. The unloading is <span class="bold"><strong>not</strong></span> immediate, because the concurrent queries
  6177. might be using it. However, after a DROP new queries will not be able
  6178. to use it. Then, once all the currently executing queries using it
  6179. are completed, the plugin will be unloaded. Once all the plugins
  6180. from the given library are unloaded, the library is also automatically
  6181. unloaded.
  6182. </p><pre class="programlisting">
  6183. mysql&gt; DROP PLUGIN myranker TYPE 'ranker';
  6184. Query OK, 0 rows affected (0.00 sec)
  6185. </pre></div>
  6186. <div class="sect1" title="8.38.&nbsp;SHOW PLUGINS syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-show-plugins"></a>8.38.&nbsp;SHOW PLUGINS syntax</h2></div></div></div>
  6187. <pre class="programlisting">
  6188. SHOW PLUGINS
  6189. </pre><p>
  6190. Added in 2.2.2-beta. Displays all the loaded plugins and UDFs.
  6191. "Type" column should be one of the udf, ranker, index_token_filter,
  6192. or query_token_filter. "Users" column is the number of thread that
  6193. are currently using that plugin in a query. "Extra" column is intended
  6194. for various additional plugin-type specific information; currently,
  6195. it shows the return type for the UDFs and is empty for all the other
  6196. plugin types.
  6197. </p><pre class="programlisting">
  6198. mysql&gt; SHOW PLUGINS;
  6199. +------+----------+----------------+-------+-------+
  6200. | Type | Name | Library | Users | Extra |
  6201. +------+----------+----------------+-------+-------+
  6202. | udf | sequence | udfexample.dll | 0 | INT |
  6203. +------+----------+----------------+-------+-------+
  6204. 1 row in set (0.00 sec)
  6205. </pre></div>
  6206. <div class="sect1" title="8.39.&nbsp;SHOW THREADS syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-threads"></a>8.39.&nbsp;SHOW THREADS syntax</h2></div></div></div>
  6207. <pre class="programlisting">
  6208. SHOW THREADS [ OPTION columns=width ]
  6209. </pre><p>
  6210. SHOW THREADS statement, introduced in version 2.2.2-beta, lists all
  6211. currently active client threads, not counting system threads.
  6212. It returns a table with columns that describe:
  6213. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><span class="bold"><strong>thread id</strong></span></li>
  6214. <li class="listitem"><span class="bold"><strong>connection protocol</strong></span>, possible values are sphinxapi and sphinxql</li>
  6215. <li class="listitem"><span class="bold"><strong>thread state</strong></span>, possible values are handshake, net_read,
  6216. net_write, query, net_idle</li>
  6217. <li class="listitem"><span class="bold"><strong>time</strong></span> since the current state was changed (in seconds,
  6218. with microsecond precision)</li>
  6219. <li class="listitem"><span class="bold"><strong>information</strong></span> about queries</li>
  6220. </ul></div>
  6221. <p>
  6222. The 'Info' column will be cut at the width you've specified in the
  6223. 'columns=width' option (notice the third row in the example table below).
  6224. This column will contain raw SphinxQL queries and, if there are
  6225. API queries, full text syntax and comments will be displayed.
  6226. With an API-snippet, the data size will be displayed along with the query.
  6227. </p><pre class="programlisting">
  6228. mysql&gt; SHOW THREADS OPTION columns=50;
  6229. +------+----------+-------+----------+----------------------------------------------------+
  6230. | Tid | Proto | State | Time | Info |
  6231. +------+----------+-------+----------+----------------------------------------------------+
  6232. | 5168 | sphinxql | query | 0.000002 | show threads option columns=50 |
  6233. | 5175 | sphinxql | query | 0.000002 | select * from rt where match ( 'the box' ) |
  6234. | 1168 | sphinxql | query | 0.000002 | select * from rt where match ( 'the box and faximi |
  6235. +------+----------+-------+----------+----------------------------------------------------+
  6236. 3 row in set (0.00 sec)
  6237. </pre></div>
  6238. <div class="sect1" title="8.40.&nbsp;Multi-statement queries"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-multi-queries"></a>8.40.&nbsp;Multi-statement queries</h2></div></div></div>
  6239. <p>
  6240. Starting version 2.0.1-beta, SphinxQL supports multi-statement
  6241. queries, or batches. Possible inter-statement optimizations described
  6242. in <a class="xref" href="#multi-queries" title="5.11.&nbsp;Multi-queries">Section&nbsp;5.11, &#8220;Multi-queries&#8221;</a> do apply to SphinxQL just as well.
  6243. The batched queries should be separated by a semicolon. Your MySQL
  6244. client library needs to support MySQL multi-query mechanism and
  6245. multiple result set. For instance, mysqli interface in PHP
  6246. and DBI/DBD libraries in Perl are known to work.
  6247. </p><p>
  6248. Here's a PHP sample showing how to utilize mysqli interface
  6249. with Sphinx.
  6250. </p><pre class="programlisting">
  6251. &lt;?php
  6252. $link = mysqli_connect ( "127.0.0.1", "root", "", "", 9306 );
  6253. if ( mysqli_connect_errno() )
  6254. die ( "connect failed: " . mysqli_connect_error() );
  6255. $batch = "SELECT * FROM test1 ORDER BY group_id ASC;";
  6256. $batch .= "SELECT * FROM test1 ORDER BY group_id DESC";
  6257. if ( !mysqli_multi_query ( $link, $batch ) )
  6258. die ( "query failed" );
  6259. do
  6260. {
  6261. // fetch and print result set
  6262. if ( $result = mysqli_store_result($link) )
  6263. {
  6264. while ( $row = mysqli_fetch_row($result) )
  6265. printf ( "id=%s\n", $row[0] );
  6266. mysqli_free_result($result);
  6267. }
  6268. // print divider
  6269. if ( mysqli_more_results($link) )
  6270. printf ( "------\n" );
  6271. } while ( mysqli_next_result($link) );
  6272. </pre><p>
  6273. Its output with the sample <code class="code">test1</code> index included
  6274. with Sphinx is as follows.
  6275. </p><pre class="programlisting">
  6276. $ php test_multi.php
  6277. id=1
  6278. id=2
  6279. id=3
  6280. id=4
  6281. ------
  6282. id=3
  6283. id=4
  6284. id=1
  6285. id=2
  6286. </pre><p>
  6287. </p><p>
  6288. The following statements can currently be used in a batch:
  6289. SELECT, SHOW WARNINGS, SHOW STATUS, and SHOW META. Arbitrary
  6290. sequence of these statements are allowed. The results sets
  6291. returned should match those that would be returned if the
  6292. batched queries were sent one by one.
  6293. </p></div>
  6294. <div class="sect1" title="8.41.&nbsp;Comment syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-comment-syntax"></a>8.41.&nbsp;Comment syntax</h2></div></div></div>
  6295. <p>
  6296. Since version 2.0.1-beta, SphinxQL supports C-style comment syntax.
  6297. Everything from an opening <code class="code">/*</code> sequence to a closing
  6298. <code class="code">*/</code> sequence is ignored. Comments can span multiple lines,
  6299. can not nest, and should not get logged. MySQL specific
  6300. <code class="code">/*! ... */</code> comments are also currently ignored.
  6301. (As the comments support was rather added for better compatibility
  6302. with <code class="filename">mysqldump</code> produced dumps, rather than
  6303. improving general query interoperability between Sphinx and MySQL.)
  6304. </p><pre class="programlisting">
  6305. SELECT /*! SQL_CALC_FOUND_ROWS */ col1 FROM table1 WHERE ...
  6306. </pre><p>
  6307. </p></div>
  6308. <div class="sect1" title="8.42.&nbsp;List of SphinxQL reserved keywords"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-reserved-keywords"></a>8.42.&nbsp;List of SphinxQL reserved keywords</h2></div></div></div>
  6309. <p>A complete alphabetical list of keywords that are currently reserved
  6310. in SphinxQL syntax (and therefore can not be used as identifiers).
  6311. </p><pre class="programlisting">
  6312. AND
  6313. AGENT
  6314. AS
  6315. ASC
  6316. AVG
  6317. BEGIN
  6318. BETWEEN
  6319. BY
  6320. CALL
  6321. COLLATION
  6322. COMMIT
  6323. COUNT
  6324. DELETE
  6325. DESC
  6326. DESCRIBE
  6327. DISTINCT
  6328. FALSE
  6329. FROM
  6330. GLOBAL
  6331. GROUP
  6332. ID
  6333. IN
  6334. INSERT
  6335. INTO
  6336. LIMIT
  6337. MATCH
  6338. MAX
  6339. META
  6340. MIN
  6341. NOT
  6342. NULL
  6343. OPTION
  6344. OR
  6345. ORDER
  6346. REPLACE
  6347. ROLLBACK
  6348. SELECT
  6349. SET
  6350. SHOW
  6351. START
  6352. STATUS
  6353. SUM
  6354. TABLES
  6355. TRANSACTION
  6356. TRUE
  6357. UPDATE
  6358. VALUES
  6359. VARIABLES
  6360. WARNINGS
  6361. WEIGHT
  6362. WHERE
  6363. WITHIN
  6364. </pre></div>
  6365. <div class="sect1" title="8.43.&nbsp;SphinxQL upgrade notes, version 2.0.1-beta"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxql-upgrading-magics"></a>8.43.&nbsp;SphinxQL upgrade notes, version 2.0.1-beta</h2></div></div></div>
  6366. <p>
  6367. This section only applies to existing applications that
  6368. use SphinxQL versions prior to 2.0.1-beta.
  6369. </p><p>
  6370. In previous versions, SphinxQL just wrapped around SphinxAPI
  6371. and inherited its magic columns and column set quirks. Essentially,
  6372. SphinxQL queries could return (slightly) different columns and
  6373. in a (slightly) different order than it was explicitly requested
  6374. in the query. Namely, <code class="code">weight</code> magic column (which is not
  6375. a real column in any index) was added at all times, and GROUP BY
  6376. related <code class="code">@count</code>, <code class="code">@group</code>, and <code class="code">@distinct</code>
  6377. magic columns were conditionally added when grouping. Also, the order
  6378. of columns (attributes) in the result set was actually taken from the
  6379. index rather than the query. (So if you asked for columns C, B, A
  6380. in your query but they were in the A, B, C order in the index,
  6381. they would have been returned in the A, B, C order.)
  6382. </p><p>
  6383. In version 2.0.1-beta, we fixed that. SphinxQL is now more
  6384. SQL compliant (and will be further brought in as much compliance
  6385. with standard SQL syntax as possible).
  6386. </p><p>
  6387. The important changes are as follows:
  6388. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
  6389. <span class="bold"><strong><code class="code">@ID</code> magic name is deprecated in favor of
  6390. <code class="code">ID</code>.</strong></span> Document ID is considered an attribute.
  6391. </p></li>
  6392. <li class="listitem"><p>
  6393. <span class="bold"><strong><code class="code">WEIGHT</code> is no longer implicitly returned</strong></span>,
  6394. because it is not actually a column (an index attribute),
  6395. but rather an internal function computed per each row (a match).
  6396. You have to explicitly ask for it, using the <code class="code">WEIGHT()</code>
  6397. function. (The requirement to alias the result will be lifted
  6398. in the next release.)
  6399. </p><pre class="programlisting">
  6400. SELECT id, WEIGHT() w FROM myindex WHERE MATCH('test')
  6401. </pre><p>
  6402. </p></li>
  6403. <li class="listitem"><p>
  6404. <span class="bold"><strong>You can now use quoted reserved keywords as aliases.</strong></span>
  6405. The quote character is backtick ("`", ASCII code 96 decimal,
  6406. 60 hex). One particularly useful example would be returning
  6407. <code class="code">weight</code> column like the old mode:
  6408. </p><pre class="programlisting">
  6409. SELECT id, WEIGHT() `weight` FROM myindex WHERE MATCH('test')
  6410. </pre><p>
  6411. </p></li>
  6412. <li class="listitem"><p>
  6413. The column order is now different and should now match the
  6414. one explicitly defined in the query. So if you are accessing
  6415. columns based on their position in the result set rather than
  6416. the name (for instance, by using <code class="code">mysql_fetch_row()</code>
  6417. rather than <code class="code">mysql_fetch_assoc()</code> in PHP),
  6418. <span class="bold"><strong>check and fix the order of columns in your queries.</strong></span>
  6419. </p></li>
  6420. <li class="listitem"><p>
  6421. <code class="code">SELECT *</code> return the columns in index order,
  6422. as it used to, including the ID column. However,
  6423. <span class="bold"><strong><code class="code">SELECT *</code> does not automatically return WEIGHT().</strong></span>
  6424. To update such queries in case you access columns by names,
  6425. simply add it to the query:
  6426. </p><pre class="programlisting">
  6427. SELECT *, WEIGHT() `weight` FROM myindex WHERE MATCH('test')
  6428. </pre><p>
  6429. Otherwise, i.e., in case you rely on column order, select
  6430. ID, weight, and then other columns:
  6431. </p><pre class="programlisting">
  6432. SELECT id, *, WEIGHT() `weight` FROM myindex WHERE MATCH('test')
  6433. </pre><p>
  6434. </p></li>
  6435. <li class="listitem"><p>
  6436. <span class="bold"><strong>Magic <code class="code">@count</code> and <code class="code">@distinct</code>
  6437. attributes are no longer implicitly returned</strong></span>. You now
  6438. have to explicitly ask for them when using GROUP BY.
  6439. (Also note that you currently have to alias them;
  6440. that requirement will be lifted in the future.)
  6441. </p><pre class="programlisting">
  6442. SELECT gid, COUNT(*) q FROM myindex WHERE MATCH('test')
  6443. GROUP BY gid ORDER BY q DESC
  6444. </pre><p>
  6445. </p></li>
  6446. </ul></div>
  6447. <p>
  6448. </p></div></div>
  6449. <div class="chapter" title="Chapter&nbsp;9.&nbsp;API reference"><div class="titlepage"><div><div><h2 class="title"><a name="api-reference"></a>Chapter&nbsp;9.&nbsp;API reference</h2></div></div></div>
  6450. <div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#api-funcgroup-general">9.1. General API functions</a></span></dt>
  6451. <dd><dl><dt><span class="sect2"><a href="#api-func-getlasterror">9.1.1. GetLastError</a></span></dt>
  6452. <dt><span class="sect2"><a href="#api-func-getlastwarning">9.1.2. GetLastWarning</a></span></dt>
  6453. <dt><span class="sect2"><a href="#api-func-setserver">9.1.3. SetServer</a></span></dt>
  6454. <dt><span class="sect2"><a href="#api-func-setretries">9.1.4. SetRetries</a></span></dt>
  6455. <dt><span class="sect2"><a href="#api-func-setconnecttimeout">9.1.5. SetConnectTimeout</a></span></dt>
  6456. <dt><span class="sect2"><a href="#api-func-setarrayresult">9.1.6. SetArrayResult</a></span></dt>
  6457. <dt><span class="sect2"><a href="#api-func-isconnecterror">9.1.7. IsConnectError</a></span></dt>
  6458. </dl></dd><dt><span class="sect1"><a href="#api-funcgroup-general-query-settings">9.2. General query settings</a></span></dt>
  6459. <dd><dl><dt><span class="sect2"><a href="#api-func-setlimits">9.2.1. SetLimits</a></span></dt>
  6460. <dt><span class="sect2"><a href="#api-func-setmaxquerytime">9.2.2. SetMaxQueryTime</a></span></dt>
  6461. <dt><span class="sect2"><a href="#api-func-setoverride">9.2.3. SetOverride</a></span></dt>
  6462. <dt><span class="sect2"><a href="#api-func-setselect">9.2.4. SetSelect</a></span></dt>
  6463. </dl></dd><dt><span class="sect1"><a href="#api-funcgroup-fulltext-query-settings">9.3. Full-text search query settings</a></span></dt>
  6464. <dd><dl><dt><span class="sect2"><a href="#api-func-setmatchmode">9.3.1. SetMatchMode</a></span></dt>
  6465. <dt><span class="sect2"><a href="#api-func-setrankingmode">9.3.2. SetRankingMode</a></span></dt>
  6466. <dt><span class="sect2"><a href="#api-func-setsortmode">9.3.3. SetSortMode</a></span></dt>
  6467. <dt><span class="sect2"><a href="#api-func-setweights">9.3.4. SetWeights</a></span></dt>
  6468. <dt><span class="sect2"><a href="#api-func-setfieldweights">9.3.5. SetFieldWeights</a></span></dt>
  6469. <dt><span class="sect2"><a href="#api-func-setindexweights">9.3.6. SetIndexWeights</a></span></dt>
  6470. </dl></dd><dt><span class="sect1"><a href="#api-funcgroup-filtering">9.4. Result set filtering settings</a></span></dt>
  6471. <dd><dl><dt><span class="sect2"><a href="#api-func-setidrange">9.4.1. SetIDRange</a></span></dt>
  6472. <dt><span class="sect2"><a href="#api-func-setfilter">9.4.2. SetFilter</a></span></dt>
  6473. <dt><span class="sect2"><a href="#api-func-setfilterrange">9.4.3. SetFilterRange</a></span></dt>
  6474. <dt><span class="sect2"><a href="#api-func-setfilterfloatrange">9.4.4. SetFilterFloatRange</a></span></dt>
  6475. <dt><span class="sect2"><a href="#api-func-setgeoanchor">9.4.5. SetGeoAnchor</a></span></dt>
  6476. <dt><span class="sect2"><a href="#api-func-setfilterstring">9.4.6. SetFilterString</a></span></dt>
  6477. </dl></dd><dt><span class="sect1"><a href="#api-funcgroup-groupby">9.5. GROUP BY settings</a></span></dt>
  6478. <dd><dl><dt><span class="sect2"><a href="#api-func-setgroupby">9.5.1. SetGroupBy</a></span></dt>
  6479. <dt><span class="sect2"><a href="#api-func-setgroupdistinct">9.5.2. SetGroupDistinct</a></span></dt>
  6480. </dl></dd><dt><span class="sect1"><a href="#api-funcgroup-querying">9.6. Querying</a></span></dt>
  6481. <dd><dl><dt><span class="sect2"><a href="#api-func-query">9.6.1. Query</a></span></dt>
  6482. <dt><span class="sect2"><a href="#api-func-addquery">9.6.2. AddQuery</a></span></dt>
  6483. <dt><span class="sect2"><a href="#api-func-runqueries">9.6.3. RunQueries</a></span></dt>
  6484. <dt><span class="sect2"><a href="#api-func-resetfilters">9.6.4. ResetFilters</a></span></dt>
  6485. <dt><span class="sect2"><a href="#api-func-resetgroupby">9.6.5. ResetGroupBy</a></span></dt>
  6486. </dl></dd><dt><span class="sect1"><a href="#api-funcgroup-additional-functionality">9.7. Additional functionality</a></span></dt>
  6487. <dd><dl><dt><span class="sect2"><a href="#api-func-buildexcerpts">9.7.1. BuildExcerpts</a></span></dt>
  6488. <dt><span class="sect2"><a href="#api-func-updateatttributes">9.7.2. UpdateAttributes</a></span></dt>
  6489. <dt><span class="sect2"><a href="#api-func-buildkeywords">9.7.3. BuildKeywords</a></span></dt>
  6490. <dt><span class="sect2"><a href="#api-func-escapestring">9.7.4. EscapeString</a></span></dt>
  6491. <dt><span class="sect2"><a href="#api-func-status">9.7.5. Status</a></span></dt>
  6492. <dt><span class="sect2"><a href="#api-func-flushattributes">9.7.6. FlushAttributes</a></span></dt>
  6493. </dl></dd><dt><span class="sect1"><a href="#api-funcgroup-pconn">9.8. Persistent connections</a></span></dt>
  6494. <dd><dl><dt><span class="sect2"><a href="#api-func-open">9.8.1. Open</a></span></dt>
  6495. <dt><span class="sect2"><a href="#api-func-close">9.8.2. Close</a></span></dt>
  6496. </dl></dd></dl></div>
  6497. <p>
  6498. There is a number of native searchd client API implementations
  6499. for Sphinx. As of time of this writing, we officially support our own
  6500. PHP, Python, and Java implementations. There also are third party
  6501. free, open-source API implementations for Perl, Ruby, and C++.
  6502. </p><p>
  6503. The reference API implementation is in PHP, because (we believe)
  6504. Sphinx is most widely used with PHP than any other language.
  6505. This reference documentation is in turn based on reference PHP API,
  6506. and all code samples in this section will be given in PHP.
  6507. </p><p>
  6508. However, all other APIs provide the same methods and implement
  6509. the very same network protocol. Therefore the documentation does
  6510. apply to them as well. There might be minor differences as to the
  6511. method naming conventions or specific data structures used.
  6512. But the provided functionality must not differ across languages.
  6513. </p><div class="sect1" title="9.1.&nbsp;General API functions"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="api-funcgroup-general"></a>9.1.&nbsp;General API functions</h2></div></div></div>
  6514. <div class="sect2" title="9.1.1.&nbsp;GetLastError"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-getlasterror"></a>9.1.1.&nbsp;GetLastError</h3></div></div></div>
  6515. <p><span class="bold"><strong>Prototype:</strong></span> function GetLastError()</p><p>
  6516. Returns last error message, as a string, in human readable format.
  6517. If there were no errors during the previous API call, empty string is returned.
  6518. </p><p>
  6519. You should call it when any other function (such as <a class="link" href="#api-func-query" title="9.6.1.&nbsp;Query">Query()</a>)
  6520. fails (typically, the failing function returns false). The returned string will
  6521. contain the error description.
  6522. </p><p>
  6523. The error message is <span class="emphasis"><em>not</em></span> reset by this call; so you can safely
  6524. call it several times if needed.
  6525. </p></div>
  6526. <div class="sect2" title="9.1.2.&nbsp;GetLastWarning"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-getlastwarning"></a>9.1.2.&nbsp;GetLastWarning</h3></div></div></div>
  6527. <p><span class="bold"><strong>Prototype:</strong></span> function GetLastWarning ()</p><p>
  6528. Returns last warning message, as a string, in human readable format.
  6529. If there were no warnings during the previous API call, empty string is returned.
  6530. </p><p>
  6531. You should call it to verify whether your request
  6532. (such as <a class="link" href="#api-func-query" title="9.6.1.&nbsp;Query">Query()</a>) was completed but with warnings.
  6533. For instance, search query against a distributed index might complete
  6534. successfully even if several remote agents timed out. In that case,
  6535. a warning message would be produced.
  6536. </p><p>
  6537. The warning message is <span class="emphasis"><em>not</em></span> reset by this call; so you can safely
  6538. call it several times if needed.
  6539. </p></div>
  6540. <div class="sect2" title="9.1.3.&nbsp;SetServer"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-setserver"></a>9.1.3.&nbsp;SetServer</h3></div></div></div>
  6541. <p><span class="bold"><strong>Prototype:</strong></span> function SetServer ( $host, $port )</p><p>
  6542. Sets <code class="filename">searchd</code> host name and TCP port.
  6543. All subsequent requests will use the new host and port settings.
  6544. Default host and port are 'localhost' and 9312, respectively.
  6545. </p></div>
  6546. <div class="sect2" title="9.1.4.&nbsp;SetRetries"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-setretries"></a>9.1.4.&nbsp;SetRetries</h3></div></div></div>
  6547. <p><span class="bold"><strong>Prototype:</strong></span> function SetRetries ( $count, $delay=0 )</p><p>
  6548. Sets distributed retry count and delay.
  6549. </p><p>
  6550. On temporary failures <code class="filename">searchd</code> will attempt up to
  6551. <code class="code">$count</code> retries per agent. <code class="code">$delay</code> is the delay
  6552. between the retries, in milliseconds. Retries are disabled by default.
  6553. Note that this call will <span class="bold"><strong>not</strong></span> make the API itself retry on
  6554. temporary failure; it only tells <code class="filename">searchd</code> to do so.
  6555. Currently, the list of temporary failures includes all kinds of connect()
  6556. failures and maxed out (too busy) remote agents.
  6557. </p></div>
  6558. <div class="sect2" title="9.1.5.&nbsp;SetConnectTimeout"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-setconnecttimeout"></a>9.1.5.&nbsp;SetConnectTimeout</h3></div></div></div>
  6559. <p><span class="bold"><strong>Prototype:</strong></span> function SetConnectTimeout ( $timeout )</p><p>
  6560. Sets the time allowed to spend connecting to the server before giving up.
  6561. </p><p>Under some circumstances, the server can be delayed in responding, either
  6562. due to network delays, or a query backlog. In either instance, this allows
  6563. the client application programmer some degree of control over how their
  6564. program interacts with <code class="filename">searchd</code> when not available,
  6565. and can ensure that the client application does not fail due to exceeding
  6566. the script execution limits (especially in PHP).
  6567. </p><p>In the event of a failure to connect, an appropriate error code should
  6568. be returned back to the application in order for application-level error handling
  6569. to advise the user.
  6570. </p></div>
  6571. <div class="sect2" title="9.1.6.&nbsp;SetArrayResult"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-setarrayresult"></a>9.1.6.&nbsp;SetArrayResult</h3></div></div></div>
  6572. <p><span class="bold"><strong>Prototype:</strong></span> function SetArrayResult ( $arrayresult )</p><p>
  6573. PHP specific. Controls matches format in the search results set
  6574. (whether matches should be returned as an array or a hash).
  6575. </p><p>
  6576. <code class="code">$arrayresult</code> argument must be boolean. If <code class="code">$arrayresult</code> is <code class="code">false</code>
  6577. (the default mode), matches will returned in PHP hash format with
  6578. document IDs as keys, and other information (weight, attributes)
  6579. as values. If <code class="code">$arrayresult</code> is true, matches will be returned
  6580. as a plain array with complete per-match information including
  6581. document ID.
  6582. </p><p>
  6583. Introduced along with GROUP BY support on MVA attributes.
  6584. Group-by-MVA result sets may contain duplicate document IDs.
  6585. Thus they need to be returned as plain arrays, because hashes
  6586. will only keep one entry per document ID.
  6587. </p></div>
  6588. <div class="sect2" title="9.1.7.&nbsp;IsConnectError"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-isconnecterror"></a>9.1.7.&nbsp;IsConnectError</h3></div></div></div>
  6589. <p><span class="bold"><strong>Prototype:</strong></span> function IsConnectError ()</p><p>
  6590. Checks whether the last error was a network error on API side, or a remote error
  6591. reported by searchd. Returns true if the last connection attempt to searchd failed on API side,
  6592. false otherwise (if the error was remote, or there were no connection attempts at all).
  6593. Introduced in version 0.9.9-rc1.
  6594. </p></div></div>
  6595. <div class="sect1" title="9.2.&nbsp;General query settings"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="api-funcgroup-general-query-settings"></a>9.2.&nbsp;General query settings</h2></div></div></div>
  6596. <div class="sect2" title="9.2.1.&nbsp;SetLimits"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-setlimits"></a>9.2.1.&nbsp;SetLimits</h3></div></div></div>
  6597. <p><span class="bold"><strong>Prototype:</strong></span> function SetLimits ( $offset, $limit, $max_matches=1000, $cutoff=0 )</p><p>
  6598. Sets offset into server-side result set (<code class="code">$offset</code>) and amount of matches
  6599. to return to client starting from that offset (<code class="code">$limit</code>). Can additionally
  6600. control maximum server-side result set size for current query (<code class="code">$max_matches</code>)
  6601. and the threshold amount of matches to stop searching at (<code class="code">$cutoff</code>).
  6602. All parameters must be non-negative integers.
  6603. </p><p>
  6604. First two parameters to SetLimits() are identical in behavior to MySQL
  6605. LIMIT clause. They instruct <code class="filename">searchd</code> to return at
  6606. most <code class="code">$limit</code> matches starting from match number <code class="code">$offset</code>.
  6607. The default offset and limit settings are 0 and 20, that is, to return
  6608. first 20 matches.
  6609. </p><p>
  6610. <code class="code">max_matches</code> setting controls how much matches <code class="filename">searchd</code>
  6611. will keep in RAM while searching. <span class="bold"><strong>All</strong></span> matching documents will be normally
  6612. processed, ranked, filtered, and sorted even if <code class="code">max_matches</code> is set to 1.
  6613. But only best N documents are stored in memory at any given moment for performance
  6614. and RAM usage reasons, and this setting controls that N. Note that there are
  6615. <span class="bold"><strong>two</strong></span> places where <code class="code">max_matches</code> limit is enforced. Per-query
  6616. limit is controlled by this API call, but there also is per-server limit
  6617. controlled by <code class="code">max_matches</code> setting in the config file. To prevent
  6618. RAM usage abuse, server will not allow to set per-query limit
  6619. higher than the per-server limit.
  6620. </p><p>
  6621. You can't retrieve more than <code class="code">max_matches</code> matches to the client application.
  6622. The default limit is set to 1000. Normally, you must not have to go over
  6623. this limit. One thousand records is enough to present to the end user.
  6624. And if you're thinking about pulling the results to application
  6625. for further sorting or filtering, that would be <span class="bold"><strong>much</strong></span> more efficient
  6626. if performed on Sphinx side.
  6627. </p><p>
  6628. <code class="code">$cutoff</code> setting is intended for advanced performance control.
  6629. It tells <code class="filename">searchd</code> to forcibly stop search query
  6630. once <code class="code">$cutoff</code> matches had been found and processed.
  6631. </p></div>
  6632. <div class="sect2" title="9.2.2.&nbsp;SetMaxQueryTime"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-setmaxquerytime"></a>9.2.2.&nbsp;SetMaxQueryTime</h3></div></div></div>
  6633. <p><span class="bold"><strong>Prototype:</strong></span> function SetMaxQueryTime ( $max_query_time )</p><p>
  6634. Sets maximum search query time, in milliseconds. Parameter must be
  6635. a non-negative integer. Default value is 0 which means "do not limit".
  6636. </p><p>Similar to <code class="code">$cutoff</code> setting from <a class="link" href="#api-func-setlimits" title="9.2.1.&nbsp;SetLimits">SetLimits()</a>,
  6637. but limits elapsed query time instead of processed matches count. Local search queries
  6638. will be stopped once that much time has elapsed. Note that if you're performing
  6639. a search which queries several local indexes, this limit applies to each index
  6640. separately.
  6641. </p></div>
  6642. <div class="sect2" title="9.2.3.&nbsp;SetOverride"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-setoverride"></a>9.2.3.&nbsp;SetOverride</h3></div></div></div>
  6643. <p><span class="bold"><strong>DEPRECATED</strong></span></p><p><span class="bold"><strong>Prototype:</strong></span> function SetOverride ( $attrname, $attrtype, $values )</p><p>
  6644. Sets temporary (per-query) per-document attribute value overrides.
  6645. Only supports scalar attributes. $values must be a hash that maps document
  6646. IDs to overridden attribute values. Introduced in version 0.9.9-rc1.
  6647. </p><p>
  6648. Override feature lets you "temporary" update attribute values for some documents
  6649. within a single query, leaving all other queries unaffected. This might be useful
  6650. for personalized data. For example, assume you're implementing a personalized
  6651. search function that wants to boost the posts that the user's friends recommend.
  6652. Such data is not just dynamic, but also personal; so you can't simply put it
  6653. in the index because you don't want everyone's searches affected. Overrides,
  6654. on the other hand, are local to a single query and invisible to everyone else.
  6655. So you can, say, setup a "friends_weight" value for every document, defaulting to 0,
  6656. then temporary override it with 1 for documents 123, 456 and 789 (recommended by
  6657. exactly the friends of current user), and use that value when ranking.
  6658. </p></div>
  6659. <div class="sect2" title="9.2.4.&nbsp;SetSelect"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-setselect"></a>9.2.4.&nbsp;SetSelect</h3></div></div></div>
  6660. <p><span class="bold"><strong>Prototype:</strong></span> function SetSelect ( $clause )</p><p>
  6661. Sets the select clause, listing specific attributes to fetch, and <a class="link" href="#sort-expr" title="5.6.&nbsp;SPH_SORT_EXPR mode">expressions</a>
  6662. to compute and fetch. Clause syntax mimics SQL. Introduced in version 0.9.9-rc1.</p><p>
  6663. SetSelect() is very similar to the part of a typical SQL query between SELECT and FROM.
  6664. It lets you choose what attributes (columns) to fetch, and also what expressions
  6665. over the columns to compute and fetch. A certain difference from SQL is that expressions
  6666. <span class="bold"><strong>must</strong></span> always be aliased to a correct identifier (consisting of letters and digits)
  6667. using 'AS' keyword. SQL also lets you do that but does not require to. Sphinx enforces
  6668. aliases so that the computation results can always be returned under a "normal" name
  6669. in the result set, used in other clauses, etc.
  6670. </p><p>
  6671. Everything else is basically identical to SQL. Star ('*') is supported.
  6672. Functions are supported. Arbitrary amount of expressions is supported.
  6673. Computed expressions can be used for sorting, filtering, and grouping,
  6674. just as the regular attributes.
  6675. </p><p>
  6676. Starting with version 0.9.9-rc2, aggregate functions (AVG(), MIN(),
  6677. MAX(), SUM()) are supported when using GROUP BY.
  6678. </p><p>
  6679. Expression sorting (<a class="xref" href="#sort-expr" title="5.6.&nbsp;SPH_SORT_EXPR mode">Section&nbsp;5.6, &#8220;SPH_SORT_EXPR mode&#8221;</a>) and geodistance functions
  6680. (<a class="xref" href="#api-func-setgeoanchor" title="9.4.5.&nbsp;SetGeoAnchor">Section&nbsp;9.4.5, &#8220;SetGeoAnchor&#8221;</a>) are now internally implemented using
  6681. this computed expressions mechanism, using magic names '@expr' and '@geodist'
  6682. respectively.
  6683. </p><h4><a name="idp32629808"></a>Example:</h4><pre class="programlisting">
  6684. $cl-&gt;SetSelect ( "*, @weight+(user_karma+ln(pageviews))*0.1 AS myweight" );
  6685. $cl-&gt;SetSelect ( "exp_years, salary_gbp*{$gbp_usd_rate} AS salary_usd,
  6686. IF(age&gt;40,1,0) AS over40" );
  6687. $cl-&gt;SetSelect ( "*, AVG(price) AS avgprice" );
  6688. </pre></div></div>
  6689. <div class="sect1" title="9.3.&nbsp;Full-text search query settings"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="api-funcgroup-fulltext-query-settings"></a>9.3.&nbsp;Full-text search query settings</h2></div></div></div>
  6690. <div class="sect2" title="9.3.1.&nbsp;SetMatchMode"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-setmatchmode"></a>9.3.1.&nbsp;SetMatchMode</h3></div></div></div>
  6691. <p><span class="bold"><strong>DEPRECATED</strong></span></p><p><span class="bold"><strong>Prototype:</strong></span> function SetMatchMode ( $mode )</p><p>
  6692. Sets full-text query matching mode, as described in <a class="xref" href="#matching-modes" title="5.1.&nbsp;Matching modes">Section&nbsp;5.1, &#8220;Matching modes&#8221;</a>.
  6693. Parameter must be a constant specifying one of the known modes.
  6694. </p><p>
  6695. <span class="bold"><strong>WARNING:</strong></span> (PHP specific) you <span class="bold"><strong>must not</strong></span> take the matching mode
  6696. constant name in quotes, that syntax specifies a string and is incorrect:
  6697. </p><pre class="programlisting">
  6698. $cl-&gt;SetMatchMode ( "SPH_MATCH_ANY" ); // INCORRECT! will not work as expected
  6699. $cl-&gt;SetMatchMode ( SPH_MATCH_ANY ); // correct, works OK
  6700. </pre><p>
  6701. </p></div>
  6702. <div class="sect2" title="9.3.2.&nbsp;SetRankingMode"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-setrankingmode"></a>9.3.2.&nbsp;SetRankingMode</h3></div></div></div>
  6703. <p><span class="bold"><strong>Prototype:</strong></span> function SetRankingMode ( $ranker, $rankexpr="" )</p><p>
  6704. Sets ranking mode (aka ranker). Only available in SPH_MATCH_EXTENDED
  6705. matching mode. Parameter must be a constant specifying one of the known
  6706. rankers.
  6707. </p><p>
  6708. By default, in the EXTENDED matching mode Sphinx computes two factors
  6709. which contribute to the final match weight. The major part is a phrase
  6710. proximity value between the document text and the query.
  6711. The minor part is so-called BM25 statistical function, which varies
  6712. from 0 to 1 depending on the keyword frequency within document
  6713. (more occurrences yield higher weight) and within the whole index
  6714. (more rare keywords yield higher weight).
  6715. </p><p>
  6716. However, in some cases you'd want to compute weight differently -
  6717. or maybe avoid computing it at all for performance reasons because
  6718. you're sorting the result set by something else anyway. This can be
  6719. accomplished by setting the appropriate ranking mode. The list of
  6720. the modes is available in <a class="xref" href="#weighting" title="5.4.&nbsp;Search results ranking">Section&nbsp;5.4, &#8220;Search results ranking&#8221;</a>.
  6721. </p><p>
  6722. <code class="code">$rankexpr</code> argument was added in version 2.0.2-beta.
  6723. It lets you specify a ranking formula to use with the
  6724. <a class="link" href="#expression-ranker" title="5.4.3.&nbsp;Expression based ranker (SPH_RANK_EXPR)">expression based ranker</a>,
  6725. that is, when <code class="code">$ranker</code> is set to SPH_RANK_EXPR.
  6726. In all other cases, <code class="code">$rankexpr</code> is ignored.
  6727. </p></div>
  6728. <div class="sect2" title="9.3.3.&nbsp;SetSortMode"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-setsortmode"></a>9.3.3.&nbsp;SetSortMode</h3></div></div></div>
  6729. <p><span class="bold"><strong>Prototype:</strong></span> function SetSortMode ( $mode, $sortby="" )</p><p>
  6730. Set matches sorting mode, as described in <a class="xref" href="#sorting-modes" title="5.6.&nbsp;Sorting modes">Section&nbsp;5.6, &#8220;Sorting modes&#8221;</a>.
  6731. Parameter must be a constant specifying one of the known modes.
  6732. </p><p>
  6733. <span class="bold"><strong>WARNING:</strong></span> (PHP specific) you <span class="bold"><strong>must not</strong></span> take the matching mode
  6734. constant name in quotes, that syntax specifies a string and is incorrect:
  6735. </p><pre class="programlisting">
  6736. $cl-&gt;SetSortMode ( "SPH_SORT_ATTR_DESC" ); // INCORRECT! will not work as expected
  6737. $cl-&gt;SetSortMode ( SPH_SORT_ATTR_ASC ); // correct, works OK
  6738. </pre><p>
  6739. </p></div>
  6740. <div class="sect2" title="9.3.4.&nbsp;SetWeights"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-setweights"></a>9.3.4.&nbsp;SetWeights</h3></div></div></div>
  6741. <p><span class="bold"><strong>Prototype:</strong></span> function SetWeights ( $weights )</p><p>
  6742. Binds per-field weights in the order of appearance in the index.
  6743. <span class="bold"><strong>DEPRECATED</strong></span>, use <a class="link" href="#api-func-setfieldweights" title="9.3.5.&nbsp;SetFieldWeights">SetFieldWeights()</a> instead.
  6744. </p></div>
  6745. <div class="sect2" title="9.3.5.&nbsp;SetFieldWeights"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-setfieldweights"></a>9.3.5.&nbsp;SetFieldWeights</h3></div></div></div>
  6746. <p><span class="bold"><strong>Prototype:</strong></span> function SetFieldWeights ( $weights )</p><p>
  6747. Binds per-field weights by name. Parameter must be a hash (associative array)
  6748. mapping string field names to integer weights.
  6749. </p><p>
  6750. Match ranking can be affected by per-field weights. For instance,
  6751. see <a class="xref" href="#weighting" title="5.4.&nbsp;Search results ranking">Section&nbsp;5.4, &#8220;Search results ranking&#8221;</a> for an explanation how phrase proximity
  6752. ranking is affected. This call lets you specify what non-default
  6753. weights to assign to different full-text fields.
  6754. </p><p>
  6755. The weights must be positive 32-bit integers. The final weight
  6756. will be a 32-bit integer too. Default weight value is 1. Unknown
  6757. field names will be silently ignored.
  6758. </p><p>
  6759. There is no enforced limit on the maximum weight value at the
  6760. moment. However, beware that if you set it too high you can start
  6761. hitting 32-bit wraparound issues. For instance, if you set
  6762. a weight of 10,000,000 and search in extended mode, then
  6763. maximum possible weight will be equal to 10 million (your weight)
  6764. by 1 thousand (internal BM25 scaling factor, see <a class="xref" href="#weighting" title="5.4.&nbsp;Search results ranking">Section&nbsp;5.4, &#8220;Search results ranking&#8221;</a>)
  6765. by 1 or more (phrase proximity rank). The result is at least 10 billion
  6766. that does not fit in 32 bits and will be wrapped around, producing
  6767. unexpected results.
  6768. </p></div>
  6769. <div class="sect2" title="9.3.6.&nbsp;SetIndexWeights"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-setindexweights"></a>9.3.6.&nbsp;SetIndexWeights</h3></div></div></div>
  6770. <p><span class="bold"><strong>Prototype:</strong></span> function SetIndexWeights ( $weights )</p><p>
  6771. Sets per-index weights, and enables weighted summing of match weights
  6772. across different indexes. Parameter must be a hash (associative array)
  6773. mapping string index names to integer weights. Default is empty array
  6774. that means to disable weighting summing.
  6775. </p><p>
  6776. When a match with the same document ID is found in several different
  6777. local indexes, by default Sphinx simply chooses the match from the index
  6778. specified last in the query. This is to support searching through
  6779. partially overlapping index partitions.
  6780. </p><p>
  6781. However in some cases the indexes are not just partitions, and you
  6782. might want to sum the weights across the indexes instead of picking one.
  6783. <code class="code">SetIndexWeights()</code> lets you do that. With summing enabled,
  6784. final match weight in result set will be computed as a sum of match
  6785. weight coming from the given index multiplied by respective per-index
  6786. weight specified in this call. Ie. if the document 123 is found in
  6787. index A with the weight of 2, and also in index B with the weight of 3,
  6788. and you called <code class="code">SetIndexWeights ( array ( "A"=&gt;100, "B"=&gt;10 ) )</code>,
  6789. the final weight return to the client will be 2*100+3*10 = 230.
  6790. </p></div></div>
  6791. <div class="sect1" title="9.4.&nbsp;Result set filtering settings"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="api-funcgroup-filtering"></a>9.4.&nbsp;Result set filtering settings</h2></div></div></div>
  6792. <div class="sect2" title="9.4.1.&nbsp;SetIDRange"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-setidrange"></a>9.4.1.&nbsp;SetIDRange</h3></div></div></div>
  6793. <p><span class="bold"><strong>Prototype:</strong></span> function SetIDRange ( $min, $max )</p><p>
  6794. Sets an accepted range of document IDs. Parameters must be integers.
  6795. Defaults are 0 and 0; that combination means to not limit by range.
  6796. </p><p>
  6797. After this call, only those records that have document ID
  6798. between <code class="code">$min</code> and <code class="code">$max</code> (including IDs
  6799. exactly equal to <code class="code">$min</code> or <code class="code">$max</code>)
  6800. will be matched.
  6801. </p></div>
  6802. <div class="sect2" title="9.4.2.&nbsp;SetFilter"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-setfilter"></a>9.4.2.&nbsp;SetFilter</h3></div></div></div>
  6803. <p><span class="bold"><strong>Prototype:</strong></span> function SetFilter ( $attribute, $values, $exclude=false )</p><p>
  6804. Adds new integer values set filter.
  6805. </p><p>
  6806. On this call, additional new filter is added to the existing
  6807. list of filters. <code class="code">$attribute</code> must be a string with
  6808. attribute name. <code class="code">$values</code> must be a plain array
  6809. containing integer values. <code class="code">$exclude</code> must be a boolean
  6810. value; it controls whether to accept the matching documents
  6811. (default mode, when <code class="code">$exclude</code> is false) or reject them.
  6812. </p><p>
  6813. Only those documents where <code class="code">$attribute</code> column value
  6814. stored in the index matches any of the values from <code class="code">$values</code>
  6815. array will be matched (or rejected, if <code class="code">$exclude</code> is true).
  6816. </p></div>
  6817. <div class="sect2" title="9.4.3.&nbsp;SetFilterRange"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-setfilterrange"></a>9.4.3.&nbsp;SetFilterRange</h3></div></div></div>
  6818. <p><span class="bold"><strong>Prototype:</strong></span> function SetFilterRange ( $attribute, $min, $max, $exclude=false )</p><p>
  6819. Adds new integer range filter.
  6820. </p><p>
  6821. On this call, additional new filter is added to the existing
  6822. list of filters. <code class="code">$attribute</code> must be a string with
  6823. attribute name. <code class="code">$min</code> and <code class="code">$max</code> must be
  6824. integers that define the acceptable attribute values range
  6825. (including the boundaries). <code class="code">$exclude</code> must be a boolean
  6826. value; it controls whether to accept the matching documents
  6827. (default mode, when <code class="code">$exclude</code> is false) or reject them.
  6828. </p><p>
  6829. Only those documents where <code class="code">$attribute</code> column value
  6830. stored in the index is between <code class="code">$min</code> and <code class="code">$max</code>
  6831. (including values that are exactly equal to <code class="code">$min</code> or <code class="code">$max</code>)
  6832. will be matched (or rejected, if <code class="code">$exclude</code> is true).
  6833. </p></div>
  6834. <div class="sect2" title="9.4.4.&nbsp;SetFilterFloatRange"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-setfilterfloatrange"></a>9.4.4.&nbsp;SetFilterFloatRange</h3></div></div></div>
  6835. <p><span class="bold"><strong>Prototype:</strong></span> function SetFilterFloatRange ( $attribute, $min, $max, $exclude=false )</p><p>
  6836. Adds new float range filter.
  6837. </p><p>
  6838. On this call, additional new filter is added to the existing
  6839. list of filters. <code class="code">$attribute</code> must be a string with
  6840. attribute name. <code class="code">$min</code> and <code class="code">$max</code> must be
  6841. floats that define the acceptable attribute values range
  6842. (including the boundaries). <code class="code">$exclude</code> must be a boolean
  6843. value; it controls whether to accept the matching documents
  6844. (default mode, when <code class="code">$exclude</code> is false) or reject them.
  6845. </p><p>
  6846. Only those documents where <code class="code">$attribute</code> column value
  6847. stored in the index is between <code class="code">$min</code> and <code class="code">$max</code>
  6848. (including values that are exactly equal to <code class="code">$min</code> or <code class="code">$max</code>)
  6849. will be matched (or rejected, if <code class="code">$exclude</code> is true).
  6850. </p></div>
  6851. <div class="sect2" title="9.4.5.&nbsp;SetGeoAnchor"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-setgeoanchor"></a>9.4.5.&nbsp;SetGeoAnchor</h3></div></div></div>
  6852. <p><span class="bold"><strong>Prototype:</strong></span> function SetGeoAnchor ( $attrlat, $attrlong, $lat, $long )</p><p>
  6853. Sets anchor point for and geosphere distance (geodistance) calculations, and enable them.
  6854. </p><p>
  6855. <code class="code">$attrlat</code> and <code class="code">$attrlong</code> must be strings that contain the names
  6856. of latitude and longitude attributes, respectively. <code class="code">$lat</code> and <code class="code">$long</code>
  6857. are floats that specify anchor point latitude and longitude, in radians.
  6858. </p><p>
  6859. Once an anchor point is set, you can use magic <code class="code">"@geodist"</code> attribute
  6860. name in your filters and/or sorting expressions. Sphinx will compute geosphere distance
  6861. between the given anchor point and a point specified by latitude and longitude
  6862. attributes from each full-text match, and attach this value to the resulting match.
  6863. The latitude and longitude values both in <code class="code">SetGeoAnchor</code> and the index
  6864. attribute data are expected to be in radians. The result will be returned in meters,
  6865. so geodistance value of 1000.0 means 1 km. 1 mile is approximately 1609.344 meters.
  6866. </p></div>
  6867. <div class="sect2" title="9.4.6.&nbsp;SetFilterString"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-setfilterstring"></a>9.4.6.&nbsp;SetFilterString</h3></div></div></div>
  6868. <p><span class="bold"><strong>Prototype:</strong></span> function SetFilterString ( $attribute, $value, $exclude=false )</p><p>
  6869. Adds new string value filter.
  6870. </p><p>
  6871. On this call, additional new filter is added to the existing
  6872. list of filters. <code class="code">$attribute</code> must be a string with
  6873. attribute name. <code class="code">$value</code> must be a string. <code class="code">$exclude</code> must be a boolean
  6874. value; it controls whether to accept the matching documents
  6875. (default mode, when <code class="code">$exclude</code> is false) or reject them.
  6876. </p><p>
  6877. Only those documents where <code class="code">$attribute</code> column value
  6878. stored in the index matches string value from <code class="code">$value</code>
  6879. will be matched (or rejected, if <code class="code">$exclude</code> is true).
  6880. </p></div></div>
  6881. <div class="sect1" title="9.5.&nbsp;GROUP BY settings"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="api-funcgroup-groupby"></a>9.5.&nbsp;GROUP BY settings</h2></div></div></div>
  6882. <div class="sect2" title="9.5.1.&nbsp;SetGroupBy"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-setgroupby"></a>9.5.1.&nbsp;SetGroupBy</h3></div></div></div>
  6883. <p><span class="bold"><strong>Prototype:</strong></span> function SetGroupBy ( $attribute, $func, $groupsort="@group desc" )</p><p>
  6884. Sets grouping attribute, function, and groups sorting mode; and enables grouping
  6885. (as described in <a class="xref" href="#clustering" title="5.7.&nbsp;Grouping (clustering) search results">Section&nbsp;5.7, &#8220;Grouping (clustering) search results &#8221;</a>).
  6886. </p><p>
  6887. <code class="code">$attribute</code> is a string that contains group-by attribute name.
  6888. <code class="code">$func</code> is a constant that chooses a function applied to the attribute value in order to compute group-by key.
  6889. <code class="code">$groupsort</code> is a clause that controls how the groups will be sorted. Its syntax is similar
  6890. to that described in <a class="xref" href="#sort-extended" title="5.6.&nbsp;SPH_SORT_EXTENDED mode">Section&nbsp;5.6, &#8220;SPH_SORT_EXTENDED mode&#8221;</a>.
  6891. </p><p>
  6892. Grouping feature is very similar in nature to GROUP BY clause from SQL.
  6893. Results produces by this function call are going to be the same as produced
  6894. by the following pseudo code:
  6895. </p><pre class="programlisting">
  6896. SELECT ... GROUP BY $func($attribute) ORDER BY $groupsort
  6897. </pre><p>
  6898. Note that it's <code class="code">$groupsort</code> that affects the order of matches
  6899. in the final result set. Sorting mode (see <a class="xref" href="#api-func-setsortmode" title="9.3.3.&nbsp;SetSortMode">Section&nbsp;9.3.3, &#8220;SetSortMode&#8221;</a>)
  6900. affect the ordering of matches <span class="emphasis"><em>within</em></span> group, ie.
  6901. what match will be selected as the best one from the group.
  6902. So you can for instance order the groups by matches count
  6903. and select the most relevant match within each group at the same time.
  6904. </p><p>
  6905. Starting with version 0.9.9-rc2, aggregate functions (AVG(), MIN(),
  6906. MAX(), SUM()) are supported through <a class="link" href="#api-func-setselect" title="9.2.4.&nbsp;SetSelect">SetSelect()</a> API call
  6907. when using GROUP BY.
  6908. </p><p>
  6909. Starting with version 2.0.1-beta, grouping on string attributes
  6910. is supported, with respect to current collation.
  6911. </p></div>
  6912. <div class="sect2" title="9.5.2.&nbsp;SetGroupDistinct"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-setgroupdistinct"></a>9.5.2.&nbsp;SetGroupDistinct</h3></div></div></div>
  6913. <p><span class="bold"><strong>Prototype:</strong></span> function SetGroupDistinct ( $attribute )</p><p>
  6914. Sets attribute name for per-group distinct values count calculations.
  6915. Only available for grouping queries.
  6916. </p><p>
  6917. <code class="code">$attribute</code> is a string that contains the attribute name.
  6918. For each group, all values of this attribute will be stored (as RAM limits
  6919. permit), then the amount of distinct values will be calculated and returned
  6920. to the client. This feature is similar to <code class="code">COUNT(DISTINCT)</code>
  6921. clause in standard SQL; so these Sphinx calls:
  6922. </p><pre class="programlisting">
  6923. $cl-&gt;SetGroupBy ( "category", SPH_GROUPBY_ATTR, "@count desc" );
  6924. $cl-&gt;SetGroupDistinct ( "vendor" );
  6925. </pre><p>
  6926. can be expressed using the following SQL clauses:
  6927. </p><pre class="programlisting">
  6928. SELECT id, weight, all-attributes,
  6929. COUNT(DISTINCT vendor) AS @distinct,
  6930. COUNT(*) AS @count
  6931. FROM products
  6932. GROUP BY category
  6933. ORDER BY @count DESC
  6934. </pre><p>
  6935. In the sample pseudo code shown just above, <code class="code">SetGroupDistinct()</code> call
  6936. corresponds to <code class="code">COUNT(DISINCT vendor)</code> clause only.
  6937. <code class="code">GROUP BY</code>, <code class="code">ORDER BY</code>, and <code class="code">COUNT(*)</code>
  6938. clauses are all an equivalent of <code class="code">SetGroupBy()</code> settings. Both queries
  6939. will return one matching row for each category. In addition to indexed attributes,
  6940. matches will also contain total per-category matches count, and the count
  6941. of distinct vendor IDs within each category.
  6942. </p></div></div>
  6943. <div class="sect1" title="9.6.&nbsp;Querying"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="api-funcgroup-querying"></a>9.6.&nbsp;Querying</h2></div></div></div>
  6944. <div class="sect2" title="9.6.1.&nbsp;Query"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-query"></a>9.6.1.&nbsp;Query</h3></div></div></div>
  6945. <p><span class="bold"><strong>Prototype:</strong></span> function Query ( $query, $index="*", $comment="" )</p><p>
  6946. Connects to <code class="filename">searchd</code> server, runs given search query
  6947. with current settings, obtains and returns the result set.
  6948. </p><p>
  6949. <code class="code">$query</code> is a query string. <code class="code">$index</code> is an index name (or names) string.
  6950. Returns false and sets <code class="code">GetLastError()</code> message on general error.
  6951. Returns search result set on success.
  6952. Additionally, the contents of <code class="code">$comment</code> are sent to the query log, marked in square brackets, just before the search terms, which can be very useful for debugging.
  6953. Currently, the comment is limited to 128 characters.
  6954. </p><p>
  6955. Default value for <code class="code">$index</code> is <code class="code">"*"</code> that means
  6956. to query all local indexes. Characters allowed in index names include
  6957. Latin letters (a-z), numbers (0-9) and underscore (_);
  6958. everything else is considered a separator. Note that index name should
  6959. not start with underscore character. Therefore, all of the
  6960. following samples calls are valid and will search the same
  6961. two indexes:
  6962. </p><pre class="programlisting">
  6963. $cl-&gt;Query ( "test query", "main delta" );
  6964. $cl-&gt;Query ( "test query", "main;delta" );
  6965. $cl-&gt;Query ( "test query", "main, delta" );
  6966. </pre><p>
  6967. Index specification order matters. If document with identical IDs are found
  6968. in two or more indexes, weight and attribute values from the very last matching
  6969. index will be used for sorting and returning to client (unless explicitly
  6970. overridden with <a class="link" href="#api-func-setindexweights" title="9.3.6.&nbsp;SetIndexWeights">SetIndexWeights()</a>). Therefore,
  6971. in the example above, matches from "delta" index will always win over
  6972. matches from "main".
  6973. </p><p>
  6974. On success, <code class="code">Query()</code> returns a result set that contains
  6975. some of the found matches (as requested by <a class="link" href="#api-func-setlimits" title="9.2.1.&nbsp;SetLimits">SetLimits()</a>)
  6976. and additional general per-query statistics. The result set is a hash
  6977. (PHP specific; other languages might utilize other structures instead
  6978. of hash) with the following keys and values:
  6979. </p><div class="variablelist"><dl><dt><span class="term">"matches":</span></dt>
  6980. <dd><p>Hash which maps found document IDs to another small hash containing document weight and attribute values
  6981. (or an array of the similar small hashes if <a class="link" href="#api-func-setarrayresult" title="9.1.6.&nbsp;SetArrayResult">SetArrayResult()</a> was enabled).
  6982. </p></dd><dt><span class="term">"total":</span></dt>
  6983. <dd><p>Total amount of matches retrieved <span class="emphasis"><em>on server</em></span> (ie. to the server side result set) by this query.
  6984. You can retrieve up to this amount of matches from server for this query text with current query settings.
  6985. </p></dd><dt><span class="term">"total_found":</span></dt>
  6986. <dd><p>Total amount of matching documents in index (that were found and processed on server).</p></dd><dt><span class="term">"words":</span></dt>
  6987. <dd><p>Hash which maps query keywords (case-folded, stemmed, and otherwise processed) to a small hash with per-keyword statistics ("docs", "hits").</p></dd><dt><span class="term">"error":</span></dt>
  6988. <dd><p>Query error message reported by <code class="filename">searchd</code> (string, human readable). Empty if there were no errors.</p></dd><dt><span class="term">"warning":</span></dt>
  6989. <dd><p>Query warning message reported by <code class="filename">searchd</code> (string, human readable). Empty if there were no warnings.</p></dd></dl></div>
  6990. <p>
  6991. </p><p>
  6992. It should be noted that <code class="code">Query()</code> carries out the same actions as
  6993. <code class="code">AddQuery()</code> and <code class="code">RunQueries()</code> without the intermediate steps;
  6994. it is analogous to a single <code class="code">AddQuery()</code> call, followed by a corresponding
  6995. <code class="code">RunQueries()</code>, then returning the first array element of matches
  6996. (from the first, and only, query.)
  6997. </p></div>
  6998. <div class="sect2" title="9.6.2.&nbsp;AddQuery"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-addquery"></a>9.6.2.&nbsp;AddQuery</h3></div></div></div>
  6999. <p><span class="bold"><strong>Prototype:</strong></span> function AddQuery ( $query, $index="*", $comment="" )</p><p>
  7000. Adds additional query with current settings to multi-query batch.
  7001. <code class="code">$query</code> is a query string. <code class="code">$index</code> is an index name (or names) string.
  7002. Additionally if provided, the contents of <code class="code">$comment</code> are sent to the query log,
  7003. marked in square brackets, just before the search terms, which can be very useful for debugging.
  7004. Currently, this is limited to 128 characters.
  7005. Returns index to results array returned from <a class="link" href="#api-func-runqueries" title="9.6.3.&nbsp;RunQueries">RunQueries()</a>.
  7006. </p><p>
  7007. Batch queries (or multi-queries) enable <code class="filename">searchd</code> to perform internal
  7008. optimizations if possible. They also reduce network connection overheads and search process
  7009. creation overheads in all cases. They do not result in any additional overheads compared
  7010. to simple queries. Thus, if you run several different queries from your web page,
  7011. you should always consider using multi-queries.
  7012. </p><p>
  7013. For instance, running the same full-text query but with different
  7014. sorting or group-by settings will enable <code class="filename">searchd</code>
  7015. to perform expensive full-text search and ranking operation only once,
  7016. but compute multiple group-by results from its output.
  7017. </p><p>
  7018. This can be a big saver when you need to display not just plain
  7019. search results but also some per-category counts, such as the amount of
  7020. products grouped by vendor. Without multi-query, you would have to run several
  7021. queries which perform essentially the same search and retrieve the
  7022. same matches, but create result sets differently. With multi-query,
  7023. you simply pass all these queries in a single batch and Sphinx
  7024. optimizes the redundant full-text search internally.
  7025. </p><p>
  7026. <code class="code">AddQuery()</code> internally saves full current settings state
  7027. along with the query, and you can safely change them afterwards for subsequent
  7028. <code class="code">AddQuery()</code> calls. Already added queries will not be affected;
  7029. there's actually no way to change them at all. Here's an example:
  7030. </p><pre class="programlisting">
  7031. $cl-&gt;SetSortMode ( SPH_SORT_RELEVANCE );
  7032. $cl-&gt;AddQuery ( "hello world", "documents" );
  7033. $cl-&gt;SetSortMode ( SPH_SORT_ATTR_DESC, "price" );
  7034. $cl-&gt;AddQuery ( "ipod", "products" );
  7035. $cl-&gt;AddQuery ( "harry potter", "books" );
  7036. $results = $cl-&gt;RunQueries ();
  7037. </pre><p>
  7038. With the code above, 1st query will search for "hello world" in "documents" index
  7039. and sort results by relevance, 2nd query will search for "ipod" in "products"
  7040. index and sort results by price, and 3rd query will search for "harry potter"
  7041. in "books" index while still sorting by price. Note that 2nd <code class="code">SetSortMode()</code> call
  7042. does not affect the first query (because it's already added) but affects both other
  7043. subsequent queries.
  7044. </p><p>
  7045. Additionally, any filters set up before an <code class="code">AddQuery()</code> will fall through to subsequent
  7046. queries. So, if <code class="code">SetFilter()</code> is called before the first query, the same filter
  7047. will be in place for the second (and subsequent) queries batched through <code class="code">AddQuery()</code>
  7048. unless you call <code class="code">ResetFilters()</code> first. Alternatively, you can add additional filters
  7049. as well.</p><p>This would also be true for grouping options and sorting options; no current sorting,
  7050. filtering, and grouping settings are affected by this call; so subsequent queries will reuse
  7051. current query settings.
  7052. </p><p>
  7053. <code class="code">AddQuery()</code> returns an index into an array of results
  7054. that will be returned from <code class="code">RunQueries()</code> call. It is simply
  7055. a sequentially increasing 0-based integer, ie. first call will return 0,
  7056. second will return 1, and so on. Just a small helper so you won't have
  7057. to track the indexes manually if you need then.
  7058. </p></div>
  7059. <div class="sect2" title="9.6.3.&nbsp;RunQueries"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-runqueries"></a>9.6.3.&nbsp;RunQueries</h3></div></div></div>
  7060. <p><span class="bold"><strong>Prototype:</strong></span> function RunQueries ()</p><p>
  7061. Connect to searchd, runs a batch of all queries added using <code class="code">AddQuery()</code>,
  7062. obtains and returns the result sets. Returns false and sets <code class="code">GetLastError()</code>
  7063. message on general error (such as network I/O failure). Returns a plain array
  7064. of result sets on success.
  7065. </p><p>
  7066. Each result set in the returned array is exactly the same as
  7067. the result set returned from <a class="link" href="#api-func-query" title="9.6.1.&nbsp;Query"><code class="code">Query()</code></a>.
  7068. </p><p>
  7069. Note that the batch query request itself almost always succeeds -
  7070. unless there's a network error, blocking index rotation in progress,
  7071. or another general failure which prevents the whole request from being
  7072. processed.
  7073. </p><p>
  7074. However individual queries within the batch might very well fail.
  7075. In this case their respective result sets will contain non-empty <code class="code">"error"</code> message,
  7076. but no matches or query statistics. In the extreme case all queries within the batch
  7077. could fail. There still will be no general error reported, because API was able to
  7078. successfully connect to <code class="filename">searchd</code>, submit the batch, and receive
  7079. the results - but every result set will have a specific error message.
  7080. </p></div>
  7081. <div class="sect2" title="9.6.4.&nbsp;ResetFilters"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-resetfilters"></a>9.6.4.&nbsp;ResetFilters</h3></div></div></div>
  7082. <p><span class="bold"><strong>Prototype:</strong></span> function ResetFilters ()</p><p>
  7083. Clears all currently set filters.
  7084. </p><p>
  7085. This call is only normally required when using multi-queries. You might want
  7086. to set different filters for different queries in the batch. To do that,
  7087. you should call <code class="code">ResetFilters()</code> and add new filters using
  7088. the respective calls.
  7089. </p></div>
  7090. <div class="sect2" title="9.6.5.&nbsp;ResetGroupBy"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-resetgroupby"></a>9.6.5.&nbsp;ResetGroupBy</h3></div></div></div>
  7091. <p><span class="bold"><strong>Prototype:</strong></span> function ResetGroupBy ()</p><p>
  7092. Clears all currently group-by settings, and disables group-by.
  7093. </p><p>
  7094. This call is only normally required when using multi-queries.
  7095. You can change individual group-by settings using <code class="code">SetGroupBy()</code>
  7096. and <code class="code">SetGroupDistinct()</code> calls, but you can not disable
  7097. group-by using those calls. <code class="code">ResetGroupBy()</code>
  7098. fully resets previous group-by settings and disables group-by mode
  7099. in the current state, so that subsequent <code class="code">AddQuery()</code>
  7100. calls can perform non-grouping searches.
  7101. </p></div></div>
  7102. <div class="sect1" title="9.7.&nbsp;Additional functionality"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="api-funcgroup-additional-functionality"></a>9.7.&nbsp;Additional functionality</h2></div></div></div>
  7103. <div class="sect2" title="9.7.1.&nbsp;BuildExcerpts"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-buildexcerpts"></a>9.7.1.&nbsp;BuildExcerpts</h3></div></div></div>
  7104. <p><span class="bold"><strong>Prototype:</strong></span> function BuildExcerpts ( $docs, $index, $words, $opts=array() )</p><p>
  7105. Excerpts (snippets) builder function. Connects to <code class="filename">searchd</code>,
  7106. asks it to generate excerpts (snippets) from given documents, and returns the results.
  7107. </p><p>
  7108. <code class="code">$docs</code> is a plain array of strings that carry the documents' contents.
  7109. <code class="code">$index</code> is an index name string. Different settings (such as charset,
  7110. morphology, wordforms) from given index will be used.
  7111. <code class="code">$words</code> is a string that contains the keywords to highlight. They will
  7112. be processed with respect to index settings. For instance, if English stemming
  7113. is enabled in the index, "shoes" will be highlighted even if keyword is "shoe".
  7114. Starting with version 0.9.9-rc1, keywords can contain wildcards, that work similarly to
  7115. star-syntax available in queries.
  7116. <code class="code">$opts</code> is a hash which contains additional optional highlighting parameters:
  7117. </p><div class="variablelist"><dl><dt><span class="term">"before_match":</span></dt>
  7118. <dd><p>A string to insert before a keyword match. Starting with version 1.10-beta,
  7119. a %PASSAGE_ID% macro can be used in this string. The macro is replaced with an incrementing
  7120. passage number within a current snippet. Numbering starts at 1 by default but can be
  7121. overridden with "start_passage_id" option. In a multi-document call, %PASSAGE_ID% would
  7122. restart at every given document. Default is "&lt;b&gt;".</p></dd><dt><span class="term">"after_match":</span></dt>
  7123. <dd><p>A string to insert after a keyword match. Starting with version 1.10-beta,
  7124. a %PASSAGE_ID% macro can be used in this string. Default is "&lt;/b&gt;".</p></dd><dt><span class="term">"chunk_separator":</span></dt>
  7125. <dd><p>A string to insert between snippet chunks (passages). Default is "&nbsp;...&nbsp;".</p></dd><dt><span class="term">"limit":</span></dt>
  7126. <dd><p>Maximum snippet size, in symbols (codepoints). Integer, default is 256.</p></dd><dt><span class="term">"around":</span></dt>
  7127. <dd><p>How much words to pick around each matching keywords block. Integer, default is 5.</p></dd><dt><span class="term">"exact_phrase":</span></dt>
  7128. <dd><p>Whether to highlight exact query phrase matches only instead of individual keywords. Boolean, default is false.</p></dd><dt><span class="term">"use_boundaries":</span></dt>
  7129. <dd><p>Whether to additionally break passages by phrase
  7130. boundary characters, as configured in index settings with
  7131. <a class="link" href="#conf-phrase-boundary" title="12.2.25.&nbsp;phrase_boundary">phrase_boundary</a>
  7132. directive. Boolean, default is false.
  7133. </p></dd><dt><span class="term">"weight_order":</span></dt>
  7134. <dd><p>Whether to sort the extracted passages in order of relevance (decreasing weight),
  7135. or in order of appearance in the document (increasing position). Boolean, default is false.</p></dd><dt><span class="term">"query_mode":</span></dt>
  7136. <dd><p>Added in version 1.10-beta. Whether to handle $words as a query in
  7137. <a class="link" href="#extended-syntax" title="5.3.&nbsp;Extended query syntax">extended syntax</a>, or as a bag of words
  7138. (default behavior). For instance, in query mode ("one two" | "three four") will
  7139. only highlight and include those occurrences "one two" or "three four" when
  7140. the two words from each pair are adjacent to each other. In default mode,
  7141. any single occurrence of "one", "two", "three", or "four" would be
  7142. highlighted. Boolean, default is false.
  7143. </p></dd><dt><span class="term">"force_all_words":</span></dt>
  7144. <dd><p>Added in version 1.10-beta. Ignores the snippet length limit until it
  7145. includes all the keywords. Boolean, default is false.
  7146. </p></dd><dt><span class="term">"limit_passages":</span></dt>
  7147. <dd><p>Added in version 1.10-beta. Limits the maximum number of passages
  7148. that can be included into the snippet. Integer, default is 0 (no limit).
  7149. </p></dd><dt><span class="term">"limit_words":</span></dt>
  7150. <dd><p>Added in version 1.10-beta. Limits the maximum number of words
  7151. that can be included into the snippet. Note the limit applies to any words, and
  7152. not just the matched keywords to highlight. For example, if we are highlighting
  7153. "Mary" and a passage "Mary had a little lamb" is selected, then it contributes
  7154. 5 words to this limit, not just 1. Integer, default is 0 (no limit).
  7155. </p></dd><dt><span class="term">"start_passage_id":</span></dt>
  7156. <dd><p>Added in version 1.10-beta. Specifies the starting value of
  7157. %PASSAGE_ID% macro (that gets detected and expanded in <code class="option">before_match</code>,
  7158. <code class="option">after_match</code> strings). Integer, default is 1.
  7159. </p></dd><dt><span class="term">"load_files":</span></dt>
  7160. <dd><p>Added in version 1.10-beta. Whether to handle $docs as data
  7161. to extract snippets from (default behavior), or to treat it as file names,
  7162. and load data from specified files on the server side. Starting with
  7163. version 2.0.1-beta, up to <a class="link" href="#conf-dist-threads" title="12.4.24.&nbsp;dist_threads">dist_threads</a>
  7164. worker threads per request will be created to parallelize the work
  7165. when this flag is enabled. Boolean, default is false. Starting with version 2.0.2-beta,
  7166. building of the snippets could be parallelized between remote agents. Just set the <a class="link" href="#conf-dist-threads" title="12.4.24.&nbsp;dist_threads">'dist_threads'</a> param in the config
  7167. to the value greater than 1, and then invoke the snippets
  7168. generation over the distributed index, which contain only one(!) <a class="link" href="#conf-local" title="12.2.30.&nbsp;local">local</a> agent and several remotes.
  7169. Starting with version 2.1.1-beta, the <a class="link" href="#conf-snippets-file-prefix" title="12.4.28.&nbsp;snippets_file_prefix">snippets_file_prefix</a> option is
  7170. also in the game and the final filename is calculated by concatenation of the prefix with given name.
  7171. Otherwords, when snippets_file_prefix is '/var/data' and filename is 'text.txt' the sphinx will try to generate the snippets
  7172. from the file '/var/datatext.txt', which is exactly '/var/data' + 'text.txt'.
  7173. </p></dd><dt><span class="term">"load_files_scattered":</span></dt>
  7174. <dd><p>Added in version 2.0.2-beta. It works only with distributed snippets generation
  7175. with remote agents. The source files for snippets could be distributed among different agents, and the main daemon will merge
  7176. together all non-erroneous results. So, if one agent of the distributed index has 'file1.txt', another has 'file2.txt' and you call for the snippets
  7177. with both these files, the sphinx will merge results from the agents together, so you will get the snippets from both 'file1.txt' and 'file2.txt'.
  7178. Boolean, default is false.
  7179. </p><p>If the "load_files" is also set, the request will return the error in case if any of the files is not available anywhere. Otherwise (if "load_files" is not set)
  7180. it will just return the empty strings for all absent files. The master instance reset this flag when distributes the snippets among agents. So, for agents the absence of a file
  7181. is not critical error, but for the master it might be so. If you want to be sure that all snippets are actually created, set both "load_files_scattered" and "load_files". If the
  7182. absence of some snippets caused by some agents is not critical for you - set just "load_files_scattered", leaving "load_files" not set.
  7183. </p></dd><dt><span class="term">"html_strip_mode":</span></dt>
  7184. <dd><p>Added in version 1.10-beta. HTML stripping mode setting.
  7185. Defaults to "index", which means that index settings will be used.
  7186. The other values are "none" and "strip", that forcibly skip or apply
  7187. stripping irregardless of index settings; and "retain", that retains
  7188. HTML markup and protects it from highlighting. The "retain" mode can
  7189. only be used when highlighting full documents and thus requires that
  7190. no snippet size limits are set. String, allowed values are "none",
  7191. "strip", "index", and "retain".
  7192. </p></dd><dt><span class="term">"allow_empty":</span></dt>
  7193. <dd><p>Added in version 1.10-beta. Allows empty string to be
  7194. returned as highlighting result when a snippet could not be generated
  7195. (no keywords match, or no passages fit the limit). By default,
  7196. the beginning of original text would be returned instead of an empty
  7197. string. Boolean, default is false.
  7198. </p></dd><dt><span class="term">"passage_boundary":</span></dt>
  7199. <dd><p>Added in version 2.0.1-beta. Ensures that passages do not
  7200. cross a sentence, paragraph, or zone boundary (when used with an index
  7201. that has the respective indexing settings enabled). String, allowed
  7202. values are "sentence", "paragraph", and "zone".
  7203. </p></dd><dt><span class="term">"emit_zones":</span></dt>
  7204. <dd><p>Added in version 2.0.1-beta. Emits an HTML tag with
  7205. an enclosing zone name before each passage. Boolean, default is false.
  7206. </p></dd></dl></div>
  7207. <p>
  7208. </p><p>
  7209. Snippets extraction algorithm currently favors better passages
  7210. (with closer phrase matches), and then passages with keywords not
  7211. yet in snippet. Generally, it will try to highlight the best match
  7212. with the query, and it will also to highlight all the query keywords,
  7213. as made possible by the limits. In case the document does not match
  7214. the query, beginning of the document trimmed down according to the
  7215. limits will be return by default. Starting with 1.10-beta, you can
  7216. also return an empty snippet instead case by setting "allow_empty"
  7217. option to true.
  7218. </p><p>
  7219. Returns false on failure. Returns a plain array of strings with excerpts (snippets) on success.
  7220. </p></div>
  7221. <div class="sect2" title="9.7.2.&nbsp;UpdateAttributes"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-updateatttributes"></a>9.7.2.&nbsp;UpdateAttributes</h3></div></div></div>
  7222. <p><span class="bold"><strong>Prototype:</strong></span> function UpdateAttributes ( $index, $attrs, $values, $mva=false, $ignorenonexistent=false )</p><p>
  7223. Instantly updates given attribute values in given documents.
  7224. Returns number of actually updated documents (0 or more) on success, or -1 on failure.
  7225. </p><p>
  7226. <code class="code">$index</code> is a name of the index (or indexes) to be updated.
  7227. <code class="code">$attrs</code> is a plain array with string attribute names, listing attributes that are updated.
  7228. <code class="code">$values</code> is a hash where key is document ID, and value is a plain array of new attribute values.
  7229. Optional boolean parameter <code class="code">mva</code> points that there is update of MVA
  7230. attributes. In this case the $values must be a dict with int key (document ID)
  7231. and list of lists of int values (new MVA attribute values).
  7232. Optional boolean parameter <code class="code">$ignorenonexistent</code>
  7233. (added in version 2.1.1-beta) points that the
  7234. update will silently ignore any warnings about trying to update a
  7235. column which is not exists in current index schema. </p><p>
  7236. <code class="code">$index</code> can be either a single index name or a list, like in <code class="code">Query()</code>.
  7237. Unlike <code class="code">Query()</code>, wildcard is not allowed and all the indexes
  7238. to update must be specified explicitly. The list of indexes can include
  7239. distributed index names. Updates on distributed indexes will be pushed
  7240. to all agents.
  7241. </p><p>
  7242. The updates only work with <code class="code">docinfo=extern</code> storage strategy.
  7243. They are very fast because they're working fully in RAM, but they can also
  7244. be made persistent: updates are saved on disk on clean <code class="filename">searchd</code>
  7245. shutdown initiated by SIGTERM signal. With additional restrictions, updates
  7246. are also possible on MVA attributes; refer to <a class="link" href="#conf-mva-updates-pool" title="12.4.14.&nbsp;mva_updates_pool">mva_updates_pool</a>
  7247. directive for details.
  7248. </p><p>
  7249. Usage example:
  7250. </p><pre class="programlisting">
  7251. $cl-&gt;UpdateAttributes ( "test1", array("group_id"), array(1=&gt;array(456)) );
  7252. $cl-&gt;UpdateAttributes ( "products", array ( "price", "amount_in_stock" ),
  7253. array ( 1001=&gt;array(123,5), 1002=&gt;array(37,11), 1003=&gt;(25,129) ) );
  7254. </pre><p>
  7255. The first sample statement will update document 1 in index "test1", setting "group_id" to 456.
  7256. The second one will update documents 1001, 1002 and 1003 in index "products". For document 1001,
  7257. the new price will be set to 123 and the new amount in stock to 5; for document 1002, the new price
  7258. will be 37 and the new amount will be 11; etc.
  7259. </p></div>
  7260. <div class="sect2" title="9.7.3.&nbsp;BuildKeywords"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-buildkeywords"></a>9.7.3.&nbsp;BuildKeywords</h3></div></div></div>
  7261. <p><span class="bold"><strong>Prototype:</strong></span> function BuildKeywords ( $query, $index, $hits )</p><p>
  7262. Extracts keywords from query using tokenizer settings for given index, optionally with per-keyword occurrence statistics.
  7263. Returns an array of hashes with per-keyword information.
  7264. </p><p>
  7265. <code class="code">$query</code> is a query to extract keywords from.
  7266. <code class="code">$index</code> is a name of the index to get tokenizing settings and keyword occurrence statistics from.
  7267. <code class="code">$hits</code> is a boolean flag that indicates whether keyword occurrence statistics are required.
  7268. </p><p>
  7269. Usage example:
  7270. </p><pre class="programlisting">
  7271. $keywords = $cl-&gt;BuildKeywords ( "this.is.my query", "test1", false );
  7272. </pre></div>
  7273. <div class="sect2" title="9.7.4.&nbsp;EscapeString"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-escapestring"></a>9.7.4.&nbsp;EscapeString</h3></div></div></div>
  7274. <p><span class="bold"><strong>Prototype:</strong></span> function EscapeString ( $string )</p><p>
  7275. Escapes characters that are treated as special operators by the query language parser.
  7276. Returns an escaped string.
  7277. </p><p>
  7278. <code class="code">$string</code> is a string to escape.
  7279. </p><p>
  7280. This function might seem redundant because it's trivial to implement in any calling
  7281. application. However, as the set of special characters might change over time, it makes
  7282. sense to have an API call that is guaranteed to escape all such characters at all times.
  7283. </p><p>
  7284. Usage example:
  7285. </p><pre class="programlisting">
  7286. $escaped = $cl-&gt;EscapeString ( "escaping-sample@query/string" );
  7287. </pre></div>
  7288. <div class="sect2" title="9.7.5.&nbsp;Status"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-status"></a>9.7.5.&nbsp;Status</h3></div></div></div>
  7289. <p><span class="bold"><strong>Prototype:</strong></span> function Status ()</p><p>
  7290. Queries searchd status, and returns an array of status variable name and value pairs.
  7291. </p><p>
  7292. Usage example:
  7293. </p><pre class="programlisting">
  7294. $status = $cl-&gt;Status ();
  7295. foreach ( $status as $row )
  7296. print join ( ": ", $row ) . "\n";
  7297. </pre></div>
  7298. <div class="sect2" title="9.7.6.&nbsp;FlushAttributes"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-flushattributes"></a>9.7.6.&nbsp;FlushAttributes</h3></div></div></div>
  7299. <p><span class="bold"><strong>Prototype:</strong></span> function FlushAttributes ()</p><p>
  7300. Forces <code class="filename">searchd</code> to flush pending attribute updates
  7301. to disk, and blocks until completion. Returns a non-negative internal
  7302. "flush tag" on success. Returns -1 and sets an error message on error.
  7303. Introduced in version 1.10-beta.
  7304. </p><p>
  7305. Attribute values updated using <a class="link" href="#api-func-updateatttributes" title="9.7.2.&nbsp;UpdateAttributes">UpdateAttributes()</a>
  7306. API call are only kept in RAM until a so-called flush (which writes
  7307. the current, possibly updated attribute values back to disk). FlushAttributes()
  7308. call lets you enforce a flush. The call will block until <code class="filename">searchd</code>
  7309. finishes writing the data to disk, which might take seconds or even minutes
  7310. depending on the total data size (.spa file size). All the currently updated
  7311. indexes will be flushed.
  7312. </p><p>
  7313. Flush tag should be treated as an ever growing magic number that does not
  7314. mean anything. It's guaranteed to be non-negative. It is guaranteed to grow over
  7315. time, though not necessarily in a sequential fashion; for instance, two calls that
  7316. return 10 and then 1000 respectively are a valid situation. If two calls to
  7317. FlushAttrs() return the same tag, it means that there were no actual attribute
  7318. updates in between them, and therefore current flushed state remained the same
  7319. (for all indexes).
  7320. </p><p>
  7321. Usage example:
  7322. </p><pre class="programlisting">
  7323. $status = $cl-&gt;FlushAttributes ();
  7324. if ( $status&lt;0 )
  7325. print "ERROR: " . $cl-&gt;GetLastError();
  7326. </pre></div></div>
  7327. <div class="sect1" title="9.8.&nbsp;Persistent connections"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="api-funcgroup-pconn"></a>9.8.&nbsp;Persistent connections</h2></div></div></div>
  7328. <p>
  7329. Persistent connections allow to use single network connection to run
  7330. multiple commands that would otherwise require reconnects.
  7331. </p><div class="sect2" title="9.8.1.&nbsp;Open"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-open"></a>9.8.1.&nbsp;Open</h3></div></div></div>
  7332. <p><span class="bold"><strong>Prototype:</strong></span> function Open ()</p><p>
  7333. Opens persistent connection to the server.
  7334. </p></div>
  7335. <div class="sect2" title="9.8.2.&nbsp;Close"><div class="titlepage"><div><div><h3 class="title"><a name="api-func-close"></a>9.8.2.&nbsp;Close</h3></div></div></div>
  7336. <p><span class="bold"><strong>Prototype:</strong></span> function Close ()</p><p>
  7337. Closes previously opened persistent connection.
  7338. </p></div></div></div>
  7339. <div class="chapter" title="Chapter&nbsp;10.&nbsp;MySQL storage engine (SphinxSE)"><div class="titlepage"><div><div><h2 class="title"><a name="sphinxse"></a>Chapter&nbsp;10.&nbsp;MySQL storage engine (SphinxSE)</h2></div></div></div>
  7340. <div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#sphinxse-overview">10.1. SphinxSE overview</a></span></dt>
  7341. <dt><span class="sect1"><a href="#sphinxse-installing">10.2. Installing SphinxSE</a></span></dt>
  7342. <dd><dl><dt><span class="sect2"><a href="#sphinxse-mysql50">10.2.1. Compiling MySQL 5.0.x with SphinxSE</a></span></dt>
  7343. <dt><span class="sect2"><a href="#sphinxse-mysql51">10.2.2. Compiling MySQL 5.1.x with SphinxSE</a></span></dt>
  7344. <dt><span class="sect2"><a href="#sphinxse-checking">10.2.3. Checking SphinxSE installation</a></span></dt>
  7345. </dl></dd><dt><span class="sect1"><a href="#sphinxse-using">10.3. Using SphinxSE</a></span></dt>
  7346. <dt><span class="sect1"><a href="#sphinxse-snippets">10.4. Building snippets (excerpts) via MySQL</a></span></dt>
  7347. </dl></div>
  7348. <div class="sect1" title="10.1.&nbsp;SphinxSE overview"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxse-overview"></a>10.1.&nbsp;SphinxSE overview</h2></div></div></div>
  7349. <p>
  7350. SphinxSE is MySQL storage engine which can be compiled
  7351. into MySQL server 5.x using its pluggable architecture.
  7352. It is not available for MySQL 4.x series. It also requires
  7353. MySQL 5.0.22 or higher in 5.0.x series, or MySQL 5.1.12
  7354. or higher in 5.1.x series.
  7355. </p><p>
  7356. Despite the name, SphinxSE does <span class="emphasis"><em>not</em></span>
  7357. actually store any data itself. It is actually a built-in client
  7358. which allows MySQL server to talk to <code class="filename">searchd</code>,
  7359. run search queries, and obtain search results. All indexing and
  7360. searching happen outside MySQL.
  7361. </p><p>
  7362. Obvious SphinxSE applications include:
  7363. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>easier porting of MySQL FTS applications to Sphinx;</p></li>
  7364. <li class="listitem"><p>allowing Sphinx use with programming languages for which native APIs are not available yet;</p></li>
  7365. <li class="listitem"><p>optimizations when additional Sphinx result set processing on MySQL side is required
  7366. (eg. JOINs with original document tables, additional MySQL-side filtering, etc).</p></li>
  7367. </ul></div>
  7368. <p>
  7369. </p></div>
  7370. <div class="sect1" title="10.2.&nbsp;Installing SphinxSE"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxse-installing"></a>10.2.&nbsp;Installing SphinxSE</h2></div></div></div>
  7371. <p>
  7372. You will need to obtain a copy of MySQL sources, prepare those,
  7373. and then recompile MySQL binary.
  7374. MySQL sources (mysql-5.x.yy.tar.gz) could be obtained from
  7375. <a class="ulink" href="http://dev.mysql.com" target="_top">dev.mysql.com</a> Web site.
  7376. </p><p>
  7377. For some MySQL versions, there are delta tarballs with already
  7378. prepared source versions available from Sphinx Web site. After unzipping
  7379. those over original sources MySQL would be ready to be configured and
  7380. built with Sphinx support.
  7381. </p><p>
  7382. If such tarball is not available, or does not work for you for any
  7383. reason, you would have to prepare sources manually. You will need to
  7384. GNU Autotools framework (autoconf, automake and libtool) installed
  7385. to do that.
  7386. </p><div class="sect2" title="10.2.1.&nbsp;Compiling MySQL 5.0.x with SphinxSE"><div class="titlepage"><div><div><h3 class="title"><a name="sphinxse-mysql50"></a>10.2.1.&nbsp;Compiling MySQL 5.0.x with SphinxSE</h3></div></div></div>
  7387. <div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>copy <code class="filename">sphinx.5.0.yy.diff</code> patch file
  7388. into MySQL sources directory and run
  7389. </p><pre class="programlisting">
  7390. patch -p1 &lt; sphinx.5.0.yy.diff
  7391. </pre><p>
  7392. If there's no .diff file exactly for the specific version you need
  7393. to build, try applying .diff with closest version numbers. It is important
  7394. that the patch should apply with no rejects.
  7395. </p></li>
  7396. <li class="listitem"><p>in MySQL sources directory, run
  7397. </p><pre class="programlisting">
  7398. sh BUILD/autorun.sh
  7399. </pre><p>
  7400. </p></li>
  7401. <li class="listitem"><p>in MySQL sources directory, create <code class="filename">sql/sphinx</code>
  7402. directory in and copy all files in <code class="filename">mysqlse</code> directory
  7403. from Sphinx sources there. Example:
  7404. </p><pre class="programlisting">
  7405. cp -R /root/builds/sphinx-0.9.7/mysqlse /root/builds/mysql-5.0.24/sql/sphinx
  7406. </pre><p>
  7407. </p></li>
  7408. <li class="listitem"><p>
  7409. configure MySQL and enable Sphinx engine:
  7410. </p><pre class="programlisting">
  7411. ./configure --with-sphinx-storage-engine
  7412. </pre><p>
  7413. </p></li>
  7414. <li class="listitem"><p>
  7415. build and install MySQL:
  7416. </p><pre class="programlisting">
  7417. make
  7418. make install
  7419. </pre><p>
  7420. </p></li>
  7421. </ol></div></div>
  7422. <div class="sect2" title="10.2.2.&nbsp;Compiling MySQL 5.1.x with SphinxSE"><div class="titlepage"><div><div><h3 class="title"><a name="sphinxse-mysql51"></a>10.2.2.&nbsp;Compiling MySQL 5.1.x with SphinxSE</h3></div></div></div>
  7423. <div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>in MySQL sources directory, create <code class="filename">storage/sphinx</code>
  7424. directory in and copy all files in <code class="filename">mysqlse</code> directory
  7425. from Sphinx sources there. Example:
  7426. </p><pre class="programlisting">
  7427. cp -R /root/builds/sphinx-0.9.7/mysqlse /root/builds/mysql-5.1.14/storage/sphinx
  7428. </pre><p>
  7429. </p></li>
  7430. <li class="listitem"><p>in MySQL sources directory, run
  7431. </p><pre class="programlisting">
  7432. sh BUILD/autorun.sh
  7433. </pre><p>
  7434. </p></li>
  7435. <li class="listitem"><p>
  7436. configure MySQL and enable Sphinx engine:
  7437. </p><pre class="programlisting">
  7438. ./configure --with-plugins=sphinx
  7439. </pre><p>
  7440. </p></li>
  7441. <li class="listitem"><p>
  7442. build and install MySQL:
  7443. </p><pre class="programlisting">
  7444. make
  7445. make install
  7446. </pre><p>
  7447. </p></li>
  7448. </ol></div></div>
  7449. <div class="sect2" title="10.2.3.&nbsp;Checking SphinxSE installation"><div class="titlepage"><div><div><h3 class="title"><a name="sphinxse-checking"></a>10.2.3.&nbsp;Checking SphinxSE installation</h3></div></div></div>
  7450. <p>
  7451. To check whether SphinxSE has been successfully compiled
  7452. into MySQL, launch newly built servers, run mysql client and
  7453. issue <code class="code">SHOW ENGINES</code> query. You should see a list
  7454. of all available engines. Sphinx should be present and "Support"
  7455. column should contain "YES":
  7456. </p><pre class="programlisting">
  7457. mysql&gt; show engines;
  7458. +------------+----------+-------------------------------------------------------------+
  7459. | Engine | Support | Comment |
  7460. +------------+----------+-------------------------------------------------------------+
  7461. | MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance |
  7462. ...
  7463. | SPHINX | YES | Sphinx storage engine |
  7464. ...
  7465. +------------+----------+-------------------------------------------------------------+
  7466. 13 rows in set (0.00 sec)
  7467. </pre></div></div>
  7468. <div class="sect1" title="10.3.&nbsp;Using SphinxSE"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxse-using"></a>10.3.&nbsp;Using SphinxSE</h2></div></div></div>
  7469. <p>
  7470. To search via SphinxSE, you would need to create special ENGINE=SPHINX "search table",
  7471. and then SELECT from it with full text query put into WHERE clause for query column.
  7472. </p><p>
  7473. Let's begin with an example create statement and search query:
  7474. </p><pre class="programlisting">
  7475. CREATE TABLE t1
  7476. (
  7477. id INTEGER UNSIGNED NOT NULL,
  7478. weight INTEGER NOT NULL,
  7479. query VARCHAR(3072) NOT NULL,
  7480. group_id INTEGER,
  7481. INDEX(query)
  7482. ) ENGINE=SPHINX CONNECTION="sphinx://localhost:9312/test";
  7483. SELECT * FROM t1 WHERE query='test it;mode=any';
  7484. </pre><p>
  7485. </p><p>
  7486. First 3 columns of search table <span class="emphasis"><em>must</em></span> have a types of
  7487. <code class="code">INTEGER UNSINGED</code> or <code class="code">BIGINT</code> for the 1st column (document id),
  7488. <code class="code">INTEGER</code> or <code class="code">BIGINT</code> for the 2nd column (match weight), and
  7489. <code class="code">VARCHAR</code> or <code class="code">TEXT</code> for the 3rd column (your query), respectively.
  7490. This mapping is fixed; you can not omit any of these three required columns,
  7491. or move them around, or change types. Also, query column must be indexed;
  7492. all the others must be kept unindexed. Columns' names are ignored so you
  7493. can use arbitrary ones.
  7494. </p><p>
  7495. Additional columns must be either <code class="code">INTEGER</code>, <code class="code">TIMESTAMP</code>,
  7496. <code class="code">BIGINT</code>, <code class="code">VARCHAR</code>, or <code class="code">FLOAT</code>.
  7497. They will be bound to attributes provided in Sphinx result set by name, so their
  7498. names must match attribute names specified in <code class="filename">sphinx.conf</code>.
  7499. If there's no such attribute name in Sphinx search results, column will have
  7500. <code class="code">NULL</code> values.
  7501. </p><p>
  7502. Special "virtual" attributes names can also be bound to SphinxSE columns.
  7503. <code class="code">_sph_</code> needs to be used instead of <code class="code">@</code> for that.
  7504. For instance, to obtain the values of <code class="code">@groupby</code>, <code class="code">@count</code>,
  7505. or <code class="code">@distinct</code> virtual attributes, use <code class="code">_sph_groupby</code>,
  7506. <code class="code">_sph_count</code> or <code class="code">_sph_distinct</code> column names, respectively.
  7507. </p><p>
  7508. <code class="code">CONNECTION</code> string parameter can be used to specify default
  7509. searchd host, port and indexes for queries issued using this table.
  7510. If no connection string is specified in <code class="code">CREATE TABLE</code>,
  7511. index name "*" (ie. search all indexes) and localhost:9312 are assumed.
  7512. Connection string syntax is as follows:
  7513. </p><pre class="programlisting">
  7514. CONNECTION="sphinx://HOST:PORT/INDEXNAME"
  7515. </pre><p>
  7516. You can change the default connection string later:
  7517. </p><pre class="programlisting">
  7518. ALTER TABLE t1 CONNECTION="sphinx://NEWHOST:NEWPORT/NEWINDEXNAME";
  7519. </pre><p>
  7520. You can also override all these parameters per-query.
  7521. </p><p>
  7522. As seen in example, both query text and search options should be put
  7523. into WHERE clause on search query column (ie. 3rd column); the options
  7524. are separated by semicolons; and their names from values by equality sign.
  7525. Any number of options can be specified. Available options are:
  7526. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>query - query text;</p></li>
  7527. <li class="listitem"><p>mode - matching mode. Must be one of "all", "any", "phrase",
  7528. "boolean", or "extended". Default is "all";</p></li>
  7529. <li class="listitem"><p>sort - match sorting mode. Must be one of "relevance", "attr_desc",
  7530. "attr_asc", "time_segments", or "extended". In all modes besides "relevance"
  7531. attribute name (or sorting clause for "extended") is also required after a colon:
  7532. </p><pre class="programlisting">
  7533. ... WHERE query='test;sort=attr_asc:group_id';
  7534. ... WHERE query='test;sort=extended:@weight desc, group_id asc';
  7535. </pre><p>
  7536. </p></li>
  7537. <li class="listitem"><p>offset - offset into result set, default is 0;</p></li>
  7538. <li class="listitem"><p>limit - amount of matches to retrieve from result set, default is 20;</p></li>
  7539. <li class="listitem"><p>index - names of the indexes to search:
  7540. </p><pre class="programlisting">
  7541. ... WHERE query='test;index=test1;';
  7542. ... WHERE query='test;index=test1,test2,test3;';
  7543. </pre><p>
  7544. </p></li>
  7545. <li class="listitem"><p>minid, maxid - min and max document ID to match;</p></li>
  7546. <li class="listitem"><p>weights - comma-separated list of weights to be assigned to Sphinx full-text fields:
  7547. </p><pre class="programlisting">
  7548. ... WHERE query='test;weights=1,2,3;';
  7549. </pre><p>
  7550. </p></li>
  7551. <li class="listitem"><p>filter, !filter - comma-separated attribute name and a set of values to match:
  7552. </p><pre class="programlisting">
  7553. # only include groups 1, 5 and 19
  7554. ... WHERE query='test;filter=group_id,1,5,19;';
  7555. # exclude groups 3 and 11
  7556. ... WHERE query='test;!filter=group_id,3,11;';
  7557. </pre><p>
  7558. </p></li>
  7559. <li class="listitem"><p>range, !range - comma-separated (integer or bigint) Sphinx attribute name,
  7560. and min and max values to match:
  7561. </p><pre class="programlisting">
  7562. # include groups from 3 to 7, inclusive
  7563. ... WHERE query='test;range=group_id,3,7;';
  7564. # exclude groups from 5 to 25
  7565. ... WHERE query='test;!range=group_id,5,25;';
  7566. </pre><p>
  7567. </p></li>
  7568. <li class="listitem"><p>floatrange, !floatrange - comma-separated (floating point) Sphinx attribute name,
  7569. and min and max values to match:
  7570. </p><pre class="programlisting">
  7571. # filter by a float size
  7572. ... WHERE query='test;floatrange=size,2,3;';
  7573. # pick all results within 1000 meter from geoanchor
  7574. ... WHERE query='test;floatrange=@geodist,0,1000;';
  7575. </pre><p>
  7576. </p></li>
  7577. <li class="listitem"><p>maxmatches - per-query max matches value, as in max_matches parameter to
  7578. <a class="link" href="#api-func-setlimits" title="9.2.1.&nbsp;SetLimits">SetLimits()</a> API call:
  7579. </p><pre class="programlisting">
  7580. ... WHERE query='test;maxmatches=2000;';
  7581. </pre><p>
  7582. </p></li>
  7583. <li class="listitem"><p>cutoff - maximum allowed matches, as in cutoff parameter to
  7584. <a class="link" href="#api-func-setlimits" title="9.2.1.&nbsp;SetLimits">SetLimits()</a> API call:
  7585. </p><pre class="programlisting">
  7586. ... WHERE query='test;cutoff=10000;';
  7587. </pre><p>
  7588. </p></li>
  7589. <li class="listitem"><p>maxquerytime - maximum allowed query time (in milliseconds), as in
  7590. <a class="link" href="#api-func-setmaxquerytime" title="9.2.2.&nbsp;SetMaxQueryTime">SetMaxQueryTime()</a> API call:
  7591. </p><pre class="programlisting">
  7592. ... WHERE query='test;maxquerytime=1000;';
  7593. </pre><p>
  7594. </p></li>
  7595. <li class="listitem"><p>groupby - group-by function and attribute, corresponding to
  7596. <a class="link" href="#api-func-setgroupby" title="9.5.1.&nbsp;SetGroupBy">SetGroupBy()</a> API call:
  7597. </p><pre class="programlisting">
  7598. ... WHERE query='test;groupby=day:published_ts;';
  7599. ... WHERE query='test;groupby=attr:group_id;';
  7600. </pre><p>
  7601. </p></li>
  7602. <li class="listitem"><p>groupsort - group-by sorting clause:
  7603. </p><pre class="programlisting">
  7604. ... WHERE query='test;groupsort=@count desc;';
  7605. </pre><p>
  7606. </p></li>
  7607. <li class="listitem"><p>distinct - an attribute to compute COUNT(DISTINCT) for when doing group-by, as in
  7608. <a class="link" href="#api-func-setgroupdistinct" title="9.5.2.&nbsp;SetGroupDistinct">SetGroupDistinct()</a> API call:
  7609. </p><pre class="programlisting">
  7610. ... WHERE query='test;groupby=attr:country_id;distinct=site_id';
  7611. </pre><p>
  7612. </p></li>
  7613. <li class="listitem"><p>indexweights - comma-separated list of index names and weights
  7614. to use when searching through several indexes:
  7615. </p><pre class="programlisting">
  7616. ... WHERE query='test;indexweights=idx_exact,2,idx_stemmed,1;';
  7617. </pre><p>
  7618. </p></li>
  7619. <li class="listitem"><p>fieldweights - comma-separated list of per-field weights
  7620. that can be used by the ranker:
  7621. </p><pre class="programlisting">
  7622. ... WHERE query='test;fieldweights=title,10,abstract,3,content,1;';
  7623. </pre><p>
  7624. </p></li>
  7625. <li class="listitem"><p>comment - a string to mark this query in query log
  7626. (mapping to $comment parameter in <a class="link" href="#api-func-query" title="9.6.1.&nbsp;Query">Query()</a> API call):
  7627. </p><pre class="programlisting">
  7628. ... WHERE query='test;comment=marker001;';
  7629. </pre><p>
  7630. </p></li>
  7631. <li class="listitem"><p>select - a string with expressions to compute
  7632. (mapping to <a class="link" href="#api-func-setselect" title="9.2.4.&nbsp;SetSelect">SetSelect()</a> API call):
  7633. </p><pre class="programlisting">
  7634. ... WHERE query='test;select=2*a+3*b as myexpr;';
  7635. </pre><p>
  7636. </p></li>
  7637. <li class="listitem"><p>host, port - remote <code class="filename">searchd</code> host name
  7638. and TCP port, respectively:
  7639. </p><pre class="programlisting">
  7640. ... WHERE query='test;host=sphinx-test.loc;port=7312;';
  7641. </pre><p>
  7642. </p></li>
  7643. <li class="listitem"><p>ranker - a ranking function to use with "extended" matching mode,
  7644. as in <a class="link" href="#api-func-setrankingmode" title="9.3.2.&nbsp;SetRankingMode">SetRankingMode()</a> API call
  7645. (the only mode that supports full query syntax).
  7646. Known values are "proximity_bm25", "bm25", "none", "wordcount", "proximity",
  7647. "matchany", "fieldmask", "sph04" (starting with 1.10-beta),
  7648. "expr:EXPRESSION" (starting with 2.0.4-release)
  7649. syntax to support expression-based ranker (where EXPRESSION should be replaced
  7650. with your specific ranking formula), and "export:EXPRESSION" (starting with 2.1.1-beta):
  7651. </p><pre class="programlisting">
  7652. ... WHERE query='test;mode=extended;ranker=bm25;';
  7653. ... WHERE query='test;mode=extended;ranker=expr:sum(lcs);';
  7654. </pre><p>
  7655. The "export" ranker works exactly like ranker=expr, but it stores the per-document
  7656. factor values, while ranker=expr discards them after computing the final WEIGHT() value.
  7657. Note that ranker=export is meant to be used but rarely, only to train a ML (machine learning)
  7658. function or to define your own ranking function by hand, and never in actual production. When using
  7659. this ranker, you'll probably want to examine the output of the RANKFACTORS() function (added in
  7660. version 2.1.1-beta) that produces a string with all the field level factors for each document.
  7661. </p><pre class="programlisting">
  7662. SELECT *, WEIGHT(), RANKFACTORS()
  7663. FROM myindex
  7664. WHERE MATCH('dog')
  7665. OPTION ranker=export('100*bm25')
  7666. </pre><p>would produce something like</p><pre class="programlisting">
  7667. *************************** 1. row ***************************
  7668. id: 555617
  7669. published: 1110067331
  7670. channel_id: 1059819
  7671. title: 7
  7672. content: 428
  7673. weight(): 69900
  7674. rankfactors(): bm25=699, bm25a=0.666478, field_mask=2,
  7675. doc_word_count=1, field1=(lcs=1, hit_count=4, word_count=1,
  7676. tf_idf=1.038127, min_idf=0.259532, max_idf=0.259532, sum_idf=0.259532,
  7677. min_hit_pos=120, min_best_span_pos=120, exact_hit=0,
  7678. max_window_hits=1), word1=(tf=4, idf=0.259532)
  7679. *************************** 2. row ***************************
  7680. id: 555313
  7681. published: 1108438365
  7682. channel_id: 1058561
  7683. title: 8
  7684. content: 249
  7685. weight(): 68500
  7686. rankfactors(): bm25=685, bm25a=0.675213, field_mask=3,
  7687. doc_word_count=1, field0=(lcs=1, hit_count=1, word_count=1,
  7688. tf_idf=0.259532, min_idf=0.259532, max_idf=0.259532, sum_idf=0.259532,
  7689. min_hit_pos=8, min_best_span_pos=8, exact_hit=0, max_window_hits=1),
  7690. field1=(lcs=1, hit_count=2, word_count=1, tf_idf=0.519063,
  7691. min_idf=0.259532, max_idf=0.259532, sum_idf=0.259532, min_hit_pos=36,
  7692. min_best_span_pos=36, exact_hit=0, max_window_hits=1), word1=(tf=3,
  7693. idf=0.259532)
  7694. </pre></li>
  7695. <li class="listitem"><p>geoanchor - geodistance anchor, as in
  7696. <a class="link" href="#api-func-setgeoanchor" title="9.4.5.&nbsp;SetGeoAnchor">SetGeoAnchor()</a> API call.
  7697. Takes 4 parameters which are latitude and longitude attribute names,
  7698. and anchor point coordinates respectively:
  7699. </p><pre class="programlisting">
  7700. ... WHERE query='test;geoanchor=latattr,lonattr,0.123,0.456';
  7701. </pre><p>
  7702. </p></li>
  7703. </ul></div>
  7704. <p>
  7705. </p><p>
  7706. One <span class="bold"><strong>very important</strong></span> note that it is
  7707. <span class="bold"><strong>much</strong></span> more efficient to allow Sphinx
  7708. to perform sorting, filtering and slicing the result set than to raise
  7709. max matches count and use WHERE, ORDER BY and LIMIT clauses on MySQL
  7710. side. This is for two reasons. First, Sphinx does a number of
  7711. optimizations and performs better than MySQL on these tasks.
  7712. Second, less data would need to be packed by searchd, transferred
  7713. and unpacked by SphinxSE.
  7714. </p><p>
  7715. Starting with version 0.9.9-rc1, additional query info besides result set could be
  7716. retrieved with <code class="code">SHOW ENGINE SPHINX STATUS</code> statement:
  7717. </p><pre class="programlisting">
  7718. mysql&gt; SHOW ENGINE SPHINX STATUS;
  7719. +--------+-------+-------------------------------------------------+
  7720. | Type | Name | Status |
  7721. +--------+-------+-------------------------------------------------+
  7722. | SPHINX | stats | total: 25, total found: 25, time: 126, words: 2 |
  7723. | SPHINX | words | sphinx:591:1256 soft:11076:15945 |
  7724. +--------+-------+-------------------------------------------------+
  7725. 2 rows in set (0.00 sec)
  7726. </pre><p>
  7727. This information can also be accessed through status variables. Note
  7728. that this method does not require super-user privileges.
  7729. </p><pre class="programlisting">
  7730. mysql&gt; SHOW STATUS LIKE 'sphinx_%';
  7731. +--------------------+----------------------------------+
  7732. | Variable_name | Value |
  7733. +--------------------+----------------------------------+
  7734. | sphinx_total | 25 |
  7735. | sphinx_total_found | 25 |
  7736. | sphinx_time | 126 |
  7737. | sphinx_word_count | 2 |
  7738. | sphinx_words | sphinx:591:1256 soft:11076:15945 |
  7739. +--------------------+----------------------------------+
  7740. 5 rows in set (0.00 sec)
  7741. </pre><p>
  7742. </p><p>
  7743. You could perform JOINs on SphinxSE search table and tables using
  7744. other engines. Here's an example with "documents" from example.sql:
  7745. </p><pre class="programlisting">
  7746. mysql&gt; SELECT content, date_added FROM test.documents docs
  7747. -&gt; JOIN t1 ON (docs.id=t1.id)
  7748. -&gt; WHERE query="one document;mode=any";
  7749. +-------------------------------------+---------------------+
  7750. | content | docdate |
  7751. +-------------------------------------+---------------------+
  7752. | this is my test document number two | 2006-06-17 14:04:28 |
  7753. | this is my test document number one | 2006-06-17 14:04:28 |
  7754. +-------------------------------------+---------------------+
  7755. 2 rows in set (0.00 sec)
  7756. mysql&gt; SHOW ENGINE SPHINX STATUS;
  7757. +--------+-------+---------------------------------------------+
  7758. | Type | Name | Status |
  7759. +--------+-------+---------------------------------------------+
  7760. | SPHINX | stats | total: 2, total found: 2, time: 0, words: 2 |
  7761. | SPHINX | words | one:1:2 document:2:2 |
  7762. +--------+-------+---------------------------------------------+
  7763. 2 rows in set (0.00 sec)
  7764. </pre><p>
  7765. </p></div>
  7766. <div class="sect1" title="10.4.&nbsp;Building snippets (excerpts) via MySQL"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sphinxse-snippets"></a>10.4.&nbsp;Building snippets (excerpts) via MySQL</h2></div></div></div>
  7767. <p>
  7768. Starting with version 0.9.9-rc2, SphinxSE also includes a UDF function
  7769. that lets you create snippets through MySQL. The functionality is fully
  7770. similar to <a class="link" href="#api-func-buildexcerpts" title="9.7.1.&nbsp;BuildExcerpts">BuildExcerprts</a>
  7771. API call but accessible through MySQL+SphinxSE.
  7772. </p><p>
  7773. The binary that provides the UDF is named <code class="filename">sphinx.so</code>
  7774. and should be automatically built and installed to proper location
  7775. along with SphinxSE itself. If it does not get installed automatically
  7776. for some reason, look for <code class="filename">sphinx.so</code> in the build
  7777. directory and copy it to the plugins directory of your MySQL instance.
  7778. After that, register the UDF using the following statement:
  7779. </p><pre class="programlisting">
  7780. CREATE FUNCTION sphinx_snippets RETURNS STRING SONAME 'sphinx.so';
  7781. </pre><p>
  7782. </p><p>
  7783. Function name <span class="emphasis"><em>must</em></span> be sphinx_snippets,
  7784. you can not use an arbitrary name. Function arguments are as follows:
  7785. </p><p>
  7786. <span class="bold"><strong>Prototype:</strong></span> function sphinx_snippets ( document, index, words, [options] );
  7787. </p><p>
  7788. Document and words arguments can be either strings or table columns.
  7789. Options must be specified like this: <code class="code">'value' AS option_name</code>.
  7790. For a list of supported options, refer to
  7791. <a class="link" href="#api-func-buildexcerpts" title="9.7.1.&nbsp;BuildExcerpts">BuildExcerprts()</a> API call.
  7792. The only UDF-specific additional option is named <code class="code">'sphinx'</code>
  7793. and lets you specify searchd location (host and port).
  7794. </p><p>
  7795. Usage examples:
  7796. </p><pre class="programlisting">
  7797. SELECT sphinx_snippets('hello world doc', 'main', 'world',
  7798. 'sphinx://192.168.1.1/' AS sphinx, true AS exact_phrase,
  7799. '[b]' AS before_match, '[/b]' AS after_match)
  7800. FROM documents;
  7801. SELECT title, sphinx_snippets(text, 'index', 'mysql php') AS text
  7802. FROM sphinx, documents
  7803. WHERE query='mysql php' AND sphinx.id=documents.id;
  7804. </pre><p>
  7805. </p></div></div>
  7806. <div class="chapter" title="Chapter&nbsp;11.&nbsp;Reporting bugs"><div class="titlepage"><div><div><h2 class="title"><a name="reporting-bugs"></a>Chapter&nbsp;11.&nbsp;Reporting bugs</h2></div></div></div>
  7807. <p>
  7808. Unfortunately, Sphinx is not yet 100% bug free (even though we're working hard
  7809. towards that), so you might occasionally run into some issues.
  7810. </p><p>
  7811. Reporting as much as possible about each bug is very important -
  7812. because to fix it, we need to be able either to reproduce and fix the bug,
  7813. or to deduce what's causing it from the information that you provide.
  7814. So here are some instructions on how to do that.
  7815. </p><h2><a name="idp32999280"></a>Bug-tracker</h2><p>Nothing special to say here. Here is the
  7816. &lt;a href="http://sphinxsearch.com/bugs"&gt;link&lt;/a&gt;. Create a new
  7817. ticket and describe your bug in details so both you and developers can
  7818. save their time.</p><h2><a name="idp33000656"></a>Crashes</h2><p>In case of crashes we sometimes can get enough info to fix from
  7819. backtrace.</p><p>Sphinx tries to write crash backtrace to its log file. It may look like
  7820. this:
  7821. </p><pre class="programlisting">
  7822. ./indexer(_Z12sphBacktraceib+0x2d6)[0x5d337e]
  7823. ./indexer(_Z7sigsegvi+0xbc)[0x4ce26a]
  7824. /lib64/libpthread.so.0[0x3f75a0dd40]
  7825. /lib64/libc.so.6(fwrite+0x34)[0x3f74e5f564]
  7826. ./indexer(_ZN27CSphCharsetDefinitionParser5ParseEPKcR10CSphVectorI14CSphRemapRange16CSphVe
  7827. ctorPolicyIS3_EE+0x5b)[0x51701b]
  7828. ./indexer(_ZN13ISphTokenizer14SetCaseFoldingEPKcR10CSphString+0x62)[0x517e4c]
  7829. ./indexer(_ZN17CSphTokenizerBase14SetCaseFoldingEPKcR10CSphString+0xbd)[0x518283]
  7830. ./indexer(_ZN18CSphTokenizer_SBCSILb0EEC1Ev+0x3f)[0x5b312b]
  7831. ./indexer(_Z22sphCreateSBCSTokenizerv+0x20)[0x51835c]
  7832. ./indexer(_ZN13ISphTokenizer6CreateERK21CSphTokenizerSettingsPK17CSphEmbeddedFilesR10CSphS
  7833. tring+0x47)[0x5183d7]
  7834. ./indexer(_Z7DoIndexRK17CSphConfigSectionPKcRK17SmallStringHash_TIS_EbP8_IO_FILE+0x494)[0x
  7835. 4d31c8]
  7836. ./indexer(main+0x1a17)[0x4d6719]
  7837. /lib64/libc.so.6(__libc_start_main+0xf4)[0x3f74e1d8a4]
  7838. ./indexer(__gxx_personality_v0+0x231)[0x4cd779]
  7839. </pre><p>
  7840. This is an example of a good backtrace - we can see mangled function names
  7841. here.</p><p>But sometimes backtrace may look like this:
  7842. </p><pre class="programlisting">
  7843. /opt/piler/bin/indexer[0x4c4919]
  7844. /opt/piler/bin/indexer[0x405cf0]
  7845. /lib/x86_64-linux-gnu/libpthread.so.0(+0xfcb0)[0x7fc659cb6cb0]
  7846. /opt/piler/bin/indexer[0x4237fd]
  7847. /opt/piler/bin/indexer[0x491de6]
  7848. /opt/piler/bin/indexer[0x451704]
  7849. /opt/piler/bin/indexer[0x40861a]
  7850. /opt/piler/bin/indexer[0x40442c]
  7851. /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7fc6588aa76d]
  7852. /opt/piler/bin/indexer[0x405b89]
  7853. </pre><p>
  7854. Developers can get nothing useful from those cryptic numbers. They're
  7855. ordinary humans and want to see function names. To help them you need to
  7856. provide symbols (function and variable names). If you've installed sphinx by
  7857. building from the sources, run the following command over your binary:
  7858. </p><pre class="programlisting">
  7859. nm -n indexer &gt; indexer.sym
  7860. </pre><p>
  7861. Attach this file to bug report along with backtrace. You should however ensure
  7862. that the binary is not stripped. Our official binary packages should be fine.
  7863. (That, or we have the symbols stored.) However, if you manually build Sphinx
  7864. from the source tarball, do not run <code class="filename">strip</code> utility on that
  7865. binary, and/or do not let your build/packaging system do that!</p><h2><a name="idp33007312"></a>Uploading your data</h2><p>To fix your bug developers often need to reproduce it on their machines.
  7866. To do this they need your sphinx.conf, index files, binlog (if present),
  7867. sometimes data to index (like SQL tables or XMLpipe2 data files) and queries.
  7868. </p><p>
  7869. Attach your data to ticket. In case it's too big to attach ask developers and
  7870. they give you an address to write-only FTP created exactly for such puproses.
  7871. </p></div>
  7872. <div class="chapter" title="Chapter&nbsp;12.&nbsp;sphinx.conf options reference"><div class="titlepage"><div><div><h2 class="title"><a name="conf-reference"></a>Chapter&nbsp;12.&nbsp;<code class="filename">sphinx.conf</code> options reference</h2></div></div></div>
  7873. <div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#confgroup-source">12.1. Data source configuration options</a></span></dt>
  7874. <dd><dl><dt><span class="sect2"><a href="#conf-source-type">12.1.1. type</a></span></dt>
  7875. <dt><span class="sect2"><a href="#conf-sql-host">12.1.2. sql_host</a></span></dt>
  7876. <dt><span class="sect2"><a href="#conf-sql-port">12.1.3. sql_port</a></span></dt>
  7877. <dt><span class="sect2"><a href="#conf-sql-user">12.1.4. sql_user</a></span></dt>
  7878. <dt><span class="sect2"><a href="#conf-sql-pass">12.1.5. sql_pass</a></span></dt>
  7879. <dt><span class="sect2"><a href="#conf-sql-db">12.1.6. sql_db</a></span></dt>
  7880. <dt><span class="sect2"><a href="#conf-sql-sock">12.1.7. sql_sock</a></span></dt>
  7881. <dt><span class="sect2"><a href="#conf-mysql-connect-flags">12.1.8. mysql_connect_flags</a></span></dt>
  7882. <dt><span class="sect2"><a href="#conf-mysql-ssl">12.1.9. mysql_ssl_cert, mysql_ssl_key, mysql_ssl_ca</a></span></dt>
  7883. <dt><span class="sect2"><a href="#conf-odbc-dsn">12.1.10. odbc_dsn</a></span></dt>
  7884. <dt><span class="sect2"><a href="#conf-sql-query-pre">12.1.11. sql_query_pre</a></span></dt>
  7885. <dt><span class="sect2"><a href="#conf-sql-query">12.1.12. sql_query</a></span></dt>
  7886. <dt><span class="sect2"><a href="#conf-sql-joined-field">12.1.13. sql_joined_field</a></span></dt>
  7887. <dt><span class="sect2"><a href="#conf-sql-query-range">12.1.14. sql_query_range</a></span></dt>
  7888. <dt><span class="sect2"><a href="#conf-sql-range-step">12.1.15. sql_range_step</a></span></dt>
  7889. <dt><span class="sect2"><a href="#conf-sql-query-killlist">12.1.16. sql_query_killlist</a></span></dt>
  7890. <dt><span class="sect2"><a href="#conf-sql-attr-uint">12.1.17. sql_attr_uint</a></span></dt>
  7891. <dt><span class="sect2"><a href="#conf-sql-attr-bool">12.1.18. sql_attr_bool</a></span></dt>
  7892. <dt><span class="sect2"><a href="#conf-sql-attr-bigint">12.1.19. sql_attr_bigint</a></span></dt>
  7893. <dt><span class="sect2"><a href="#conf-sql-attr-timestamp">12.1.20. sql_attr_timestamp</a></span></dt>
  7894. <dt><span class="sect2"><a href="#conf-sql-attr-float">12.1.21. sql_attr_float</a></span></dt>
  7895. <dt><span class="sect2"><a href="#conf-sql-attr-multi">12.1.22. sql_attr_multi</a></span></dt>
  7896. <dt><span class="sect2"><a href="#conf-sql-attr-string">12.1.23. sql_attr_string</a></span></dt>
  7897. <dt><span class="sect2"><a href="#conf-sql-attr-json">12.1.24. sql_attr_json</a></span></dt>
  7898. <dt><span class="sect2"><a href="#conf-sql-column-buffers">12.1.25. sql_column_buffers</a></span></dt>
  7899. <dt><span class="sect2"><a href="#conf-sql-field-string">12.1.26. sql_field_string</a></span></dt>
  7900. <dt><span class="sect2"><a href="#conf-sql-file-field">12.1.27. sql_file_field</a></span></dt>
  7901. <dt><span class="sect2"><a href="#conf-sql-query-post">12.1.28. sql_query_post</a></span></dt>
  7902. <dt><span class="sect2"><a href="#conf-sql-query-post-index">12.1.29. sql_query_post_index</a></span></dt>
  7903. <dt><span class="sect2"><a href="#conf-sql-ranged-throttle">12.1.30. sql_ranged_throttle</a></span></dt>
  7904. <dt><span class="sect2"><a href="#conf-xmlpipe-command">12.1.31. xmlpipe_command</a></span></dt>
  7905. <dt><span class="sect2"><a href="#conf-xmlpipe-field">12.1.32. xmlpipe_field</a></span></dt>
  7906. <dt><span class="sect2"><a href="#conf-xmlpipe-field-string">12.1.33. xmlpipe_field_string</a></span></dt>
  7907. <dt><span class="sect2"><a href="#conf-xmlpipe-attr-uint">12.1.34. xmlpipe_attr_uint</a></span></dt>
  7908. <dt><span class="sect2"><a href="#conf-xmlpipe-attr-bigint">12.1.35. xmlpipe_attr_bigint</a></span></dt>
  7909. <dt><span class="sect2"><a href="#conf-xmlpipe-attr-bool">12.1.36. xmlpipe_attr_bool</a></span></dt>
  7910. <dt><span class="sect2"><a href="#conf-xmlpipe-attr-timestamp">12.1.37. xmlpipe_attr_timestamp</a></span></dt>
  7911. <dt><span class="sect2"><a href="#conf-xmlpipe-attr-float">12.1.38. xmlpipe_attr_float</a></span></dt>
  7912. <dt><span class="sect2"><a href="#conf-xmlpipe-attr-multi">12.1.39. xmlpipe_attr_multi</a></span></dt>
  7913. <dt><span class="sect2"><a href="#conf-xmlpipe-attr-multi-64">12.1.40. xmlpipe_attr_multi_64</a></span></dt>
  7914. <dt><span class="sect2"><a href="#conf-xmlpipe-attr-string">12.1.41. xmlpipe_attr_string</a></span></dt>
  7915. <dt><span class="sect2"><a href="#conf-xmlpipe-attr-json">12.1.42. xmlpipe_attr_json</a></span></dt>
  7916. <dt><span class="sect2"><a href="#conf-xmlpipe-fixup-utf8">12.1.43. xmlpipe_fixup_utf8</a></span></dt>
  7917. <dt><span class="sect2"><a href="#conf-mssql-winauth">12.1.44. mssql_winauth</a></span></dt>
  7918. <dt><span class="sect2"><a href="#conf-unpack-zlib">12.1.45. unpack_zlib</a></span></dt>
  7919. <dt><span class="sect2"><a href="#conf-unpack-mysqlcompress">12.1.46. unpack_mysqlcompress</a></span></dt>
  7920. <dt><span class="sect2"><a href="#conf-unpack-mysqlcompress-maxsize">12.1.47. unpack_mysqlcompress_maxsize</a></span></dt>
  7921. </dl></dd><dt><span class="sect1"><a href="#confgroup-index">12.2. Index configuration options</a></span></dt>
  7922. <dd><dl><dt><span class="sect2"><a href="#conf-index-type">12.2.1. type</a></span></dt>
  7923. <dt><span class="sect2"><a href="#conf-source">12.2.2. source</a></span></dt>
  7924. <dt><span class="sect2"><a href="#conf-path">12.2.3. path</a></span></dt>
  7925. <dt><span class="sect2"><a href="#conf-docinfo">12.2.4. docinfo</a></span></dt>
  7926. <dt><span class="sect2"><a href="#conf-mlock">12.2.5. mlock</a></span></dt>
  7927. <dt><span class="sect2"><a href="#conf-morphology">12.2.6. morphology</a></span></dt>
  7928. <dt><span class="sect2"><a href="#conf-dict">12.2.7. dict</a></span></dt>
  7929. <dt><span class="sect2"><a href="#conf-index-sp">12.2.8. index_sp</a></span></dt>
  7930. <dt><span class="sect2"><a href="#conf-index-zones">12.2.9. index_zones</a></span></dt>
  7931. <dt><span class="sect2"><a href="#conf-min-stemming-len">12.2.10. min_stemming_len</a></span></dt>
  7932. <dt><span class="sect2"><a href="#conf-stopwords">12.2.11. stopwords</a></span></dt>
  7933. <dt><span class="sect2"><a href="#conf-wordforms">12.2.12. wordforms</a></span></dt>
  7934. <dt><span class="sect2"><a href="#conf-embedded-limit">12.2.13. embedded_limit</a></span></dt>
  7935. <dt><span class="sect2"><a href="#conf-exceptions">12.2.14. exceptions</a></span></dt>
  7936. <dt><span class="sect2"><a href="#conf-min-word-len">12.2.15. min_word_len</a></span></dt>
  7937. <dt><span class="sect2"><a href="#conf-charset-table">12.2.16. charset_table</a></span></dt>
  7938. <dt><span class="sect2"><a href="#conf-ignore-chars">12.2.17. ignore_chars</a></span></dt>
  7939. <dt><span class="sect2"><a href="#conf-min-prefix-len">12.2.18. min_prefix_len</a></span></dt>
  7940. <dt><span class="sect2"><a href="#conf-min-infix-len">12.2.19. min_infix_len</a></span></dt>
  7941. <dt><span class="sect2"><a href="#conf-max-substring-len">12.2.20. max_substring_len</a></span></dt>
  7942. <dt><span class="sect2"><a href="#conf-prefix-fields">12.2.21. prefix_fields</a></span></dt>
  7943. <dt><span class="sect2"><a href="#conf-infix-fields">12.2.22. infix_fields</a></span></dt>
  7944. <dt><span class="sect2"><a href="#conf-ngram-len">12.2.23. ngram_len</a></span></dt>
  7945. <dt><span class="sect2"><a href="#conf-ngram-chars">12.2.24. ngram_chars</a></span></dt>
  7946. <dt><span class="sect2"><a href="#conf-phrase-boundary">12.2.25. phrase_boundary</a></span></dt>
  7947. <dt><span class="sect2"><a href="#conf-phrase-boundary-step">12.2.26. phrase_boundary_step</a></span></dt>
  7948. <dt><span class="sect2"><a href="#conf-html-strip">12.2.27. html_strip</a></span></dt>
  7949. <dt><span class="sect2"><a href="#conf-html-index-attrs">12.2.28. html_index_attrs</a></span></dt>
  7950. <dt><span class="sect2"><a href="#conf-html-remove-elements">12.2.29. html_remove_elements</a></span></dt>
  7951. <dt><span class="sect2"><a href="#conf-local">12.2.30. local</a></span></dt>
  7952. <dt><span class="sect2"><a href="#conf-agent">12.2.31. agent</a></span></dt>
  7953. <dt><span class="sect2"><a href="#conf-agent-persistent">12.2.32. agent_persistent</a></span></dt>
  7954. <dt><span class="sect2"><a href="#conf-agent-blackhole">12.2.33. agent_blackhole</a></span></dt>
  7955. <dt><span class="sect2"><a href="#conf-agent-connect-timeout">12.2.34. agent_connect_timeout</a></span></dt>
  7956. <dt><span class="sect2"><a href="#conf-agent-query-timeout">12.2.35. agent_query_timeout</a></span></dt>
  7957. <dt><span class="sect2"><a href="#conf-preopen">12.2.36. preopen</a></span></dt>
  7958. <dt><span class="sect2"><a href="#conf-inplace-enable">12.2.37. inplace_enable</a></span></dt>
  7959. <dt><span class="sect2"><a href="#conf-inplace-hit-gap">12.2.38. inplace_hit_gap</a></span></dt>
  7960. <dt><span class="sect2"><a href="#conf-inplace-docinfo-gap">12.2.39. inplace_docinfo_gap</a></span></dt>
  7961. <dt><span class="sect2"><a href="#conf-inplace-reloc-factor">12.2.40. inplace_reloc_factor</a></span></dt>
  7962. <dt><span class="sect2"><a href="#conf-inplace-write-factor">12.2.41. inplace_write_factor</a></span></dt>
  7963. <dt><span class="sect2"><a href="#conf-index-exact-words">12.2.42. index_exact_words</a></span></dt>
  7964. <dt><span class="sect2"><a href="#conf-overshort-step">12.2.43. overshort_step</a></span></dt>
  7965. <dt><span class="sect2"><a href="#conf-stopword-step">12.2.44. stopword_step</a></span></dt>
  7966. <dt><span class="sect2"><a href="#conf-hitless-words">12.2.45. hitless_words</a></span></dt>
  7967. <dt><span class="sect2"><a href="#conf-expand-keywords">12.2.46. expand_keywords</a></span></dt>
  7968. <dt><span class="sect2"><a href="#conf-blend-chars">12.2.47. blend_chars</a></span></dt>
  7969. <dt><span class="sect2"><a href="#conf-blend-mode">12.2.48. blend_mode</a></span></dt>
  7970. <dt><span class="sect2"><a href="#conf-rt-mem-limit">12.2.49. rt_mem_limit</a></span></dt>
  7971. <dt><span class="sect2"><a href="#conf-rt-field">12.2.50. rt_field</a></span></dt>
  7972. <dt><span class="sect2"><a href="#conf-rt-attr-uint">12.2.51. rt_attr_uint</a></span></dt>
  7973. <dt><span class="sect2"><a href="#conf-rt-attr-bool">12.2.52. rt_attr_bool</a></span></dt>
  7974. <dt><span class="sect2"><a href="#conf-rt-attr-bigint">12.2.53. rt_attr_bigint</a></span></dt>
  7975. <dt><span class="sect2"><a href="#conf-rt-attr-float">12.2.54. rt_attr_float</a></span></dt>
  7976. <dt><span class="sect2"><a href="#conf-rt-attr-multi">12.2.55. rt_attr_multi</a></span></dt>
  7977. <dt><span class="sect2"><a href="#conf-rt-attr-multi-64">12.2.56. rt_attr_multi_64</a></span></dt>
  7978. <dt><span class="sect2"><a href="#conf-rt-attr-timestamp">12.2.57. rt_attr_timestamp</a></span></dt>
  7979. <dt><span class="sect2"><a href="#conf-rt-attr-string">12.2.58. rt_attr_string</a></span></dt>
  7980. <dt><span class="sect2"><a href="#conf-rt-attr-json">12.2.59. rt_attr_json</a></span></dt>
  7981. <dt><span class="sect2"><a href="#conf-ha-strategy">12.2.60. ha_strategy</a></span></dt>
  7982. <dt><span class="sect2"><a href="#conf-bigram-freq-words">12.2.61. bigram_freq_words</a></span></dt>
  7983. <dt><span class="sect2"><a href="#conf-bigram-index">12.2.62. bigram_index</a></span></dt>
  7984. <dt><span class="sect2"><a href="#conf-index-field-lengths">12.2.63. index_field_lengths</a></span></dt>
  7985. <dt><span class="sect2"><a href="#conf-regexp-filter">12.2.64. regexp_filter</a></span></dt>
  7986. <dt><span class="sect2"><a href="#conf-stopwords-unstemmed">12.2.65. stopwords_unstemmed</a></span></dt>
  7987. <dt><span class="sect2"><a href="#conf-global-idf">12.2.66. global_idf</a></span></dt>
  7988. <dt><span class="sect2"><a href="#conf-rlp-context">12.2.67. rlp_context</a></span></dt>
  7989. <dt><span class="sect2"><a href="#conf-ondisk-attrs">12.2.68. ondisk_attrs</a></span></dt>
  7990. </dl></dd><dt><span class="sect1"><a href="#confgroup-indexer">12.3. <code class="filename">indexer</code> program configuration options</a></span></dt>
  7991. <dd><dl><dt><span class="sect2"><a href="#conf-mem-limit">12.3.1. mem_limit</a></span></dt>
  7992. <dt><span class="sect2"><a href="#conf-max-iops">12.3.2. max_iops</a></span></dt>
  7993. <dt><span class="sect2"><a href="#conf-max-iosize">12.3.3. max_iosize</a></span></dt>
  7994. <dt><span class="sect2"><a href="#conf-max-xmlpipe2-field">12.3.4. max_xmlpipe2_field</a></span></dt>
  7995. <dt><span class="sect2"><a href="#conf-write-buffer">12.3.5. write_buffer</a></span></dt>
  7996. <dt><span class="sect2"><a href="#conf-max-file-field-buffer">12.3.6. max_file_field_buffer</a></span></dt>
  7997. <dt><span class="sect2"><a href="#conf-on-file-field-error">12.3.7. on_file_field_error</a></span></dt>
  7998. <dt><span class="sect2"><a href="#conf-lemmatizer-cache">12.3.8. lemmatizer_cache</a></span></dt>
  7999. </dl></dd><dt><span class="sect1"><a href="#confgroup-searchd">12.4. <code class="filename">searchd</code> program configuration options</a></span></dt>
  8000. <dd><dl><dt><span class="sect2"><a href="#conf-listen">12.4.1. listen</a></span></dt>
  8001. <dt><span class="sect2"><a href="#conf-log">12.4.2. log</a></span></dt>
  8002. <dt><span class="sect2"><a href="#conf-query-log">12.4.3. query_log</a></span></dt>
  8003. <dt><span class="sect2"><a href="#conf-query-log-format">12.4.4. query_log_format</a></span></dt>
  8004. <dt><span class="sect2"><a href="#conf-read-timeout">12.4.5. read_timeout</a></span></dt>
  8005. <dt><span class="sect2"><a href="#conf-client-timeout">12.4.6. client_timeout</a></span></dt>
  8006. <dt><span class="sect2"><a href="#conf-max-children">12.4.7. max_children</a></span></dt>
  8007. <dt><span class="sect2"><a href="#conf-pid-file">12.4.8. pid_file</a></span></dt>
  8008. <dt><span class="sect2"><a href="#conf-seamless-rotate">12.4.9. seamless_rotate</a></span></dt>
  8009. <dt><span class="sect2"><a href="#conf-preopen-indexes">12.4.10. preopen_indexes</a></span></dt>
  8010. <dt><span class="sect2"><a href="#conf-unlink-old">12.4.11. unlink_old</a></span></dt>
  8011. <dt><span class="sect2"><a href="#conf-attr-flush-period">12.4.12. attr_flush_period</a></span></dt>
  8012. <dt><span class="sect2"><a href="#conf-max-packet-size">12.4.13. max_packet_size</a></span></dt>
  8013. <dt><span class="sect2"><a href="#conf-mva-updates-pool">12.4.14. mva_updates_pool</a></span></dt>
  8014. <dt><span class="sect2"><a href="#conf-max-filters">12.4.15. max_filters</a></span></dt>
  8015. <dt><span class="sect2"><a href="#conf-max-filter-values">12.4.16. max_filter_values</a></span></dt>
  8016. <dt><span class="sect2"><a href="#conf-listen-backlog">12.4.17. listen_backlog</a></span></dt>
  8017. <dt><span class="sect2"><a href="#conf-read-buffer">12.4.18. read_buffer</a></span></dt>
  8018. <dt><span class="sect2"><a href="#conf-read-unhinted">12.4.19. read_unhinted</a></span></dt>
  8019. <dt><span class="sect2"><a href="#conf-max-batch-queries">12.4.20. max_batch_queries</a></span></dt>
  8020. <dt><span class="sect2"><a href="#conf-subtree-docs-cache">12.4.21. subtree_docs_cache</a></span></dt>
  8021. <dt><span class="sect2"><a href="#conf-subtree-hits-cache">12.4.22. subtree_hits_cache</a></span></dt>
  8022. <dt><span class="sect2"><a href="#conf-workers">12.4.23. workers</a></span></dt>
  8023. <dt><span class="sect2"><a href="#conf-dist-threads">12.4.24. dist_threads</a></span></dt>
  8024. <dt><span class="sect2"><a href="#conf-binlog-path">12.4.25. binlog_path</a></span></dt>
  8025. <dt><span class="sect2"><a href="#conf-binlog-flush">12.4.26. binlog_flush</a></span></dt>
  8026. <dt><span class="sect2"><a href="#conf-binlog-max-log-size">12.4.27. binlog_max_log_size</a></span></dt>
  8027. <dt><span class="sect2"><a href="#conf-snippets-file-prefix">12.4.28. snippets_file_prefix</a></span></dt>
  8028. <dt><span class="sect2"><a href="#conf-collation-server">12.4.29. collation_server</a></span></dt>
  8029. <dt><span class="sect2"><a href="#conf-collation-libc-locale">12.4.30. collation_libc_locale</a></span></dt>
  8030. <dt><span class="sect2"><a href="#conf-plugin-dir">12.4.31. plugin_dir</a></span></dt>
  8031. <dt><span class="sect2"><a href="#conf-mysql-version-string">12.4.32. mysql_version_string</a></span></dt>
  8032. <dt><span class="sect2"><a href="#conf-rt-flush-period">12.4.33. rt_flush_period</a></span></dt>
  8033. <dt><span class="sect2"><a href="#conf-thread-stack">12.4.34. thread_stack</a></span></dt>
  8034. <dt><span class="sect2"><a href="#conf-expansion-limit">12.4.35. expansion_limit</a></span></dt>
  8035. <dt><span class="sect2"><a href="#conf-watchdog">12.4.36. watchdog</a></span></dt>
  8036. <dt><span class="sect2"><a href="#conf-prefork-rotation-throttle">12.4.37. prefork_rotation_throttle</a></span></dt>
  8037. <dt><span class="sect2"><a href="#conf-sphinxql-state">12.4.38. sphinxql_state</a></span></dt>
  8038. <dt><span class="sect2"><a href="#conf-ha-ping-interval">12.4.39. ha_ping_interval</a></span></dt>
  8039. <dt><span class="sect2"><a href="#conf-ha-period-karma">12.4.40. ha_period_karma</a></span></dt>
  8040. <dt><span class="sect2"><a href="#conf-persistent-connections-limit">12.4.41. persistent_connections_limit</a></span></dt>
  8041. <dt><span class="sect2"><a href="#conf-rt-merge-iops">12.4.42. rt_merge_iops</a></span></dt>
  8042. <dt><span class="sect2"><a href="#conf-rt-merge-maxiosize">12.4.43. rt_merge_maxiosize</a></span></dt>
  8043. <dt><span class="sect2"><a href="#conf-predicted-time-costs">12.4.44. predicted_time_costs</a></span></dt>
  8044. <dt><span class="sect2"><a href="#conf-shutdown-timeout">12.4.45. shutdown_timeout</a></span></dt>
  8045. <dt><span class="sect2"><a href="#conf-ondisk-attrs-default">12.4.46. ondisk_attrs_default</a></span></dt>
  8046. <dt><span class="sect2"><a href="#conf-query-log-min-msec">12.4.47. query_log_min_msec</a></span></dt>
  8047. <dt><span class="sect2"><a href="#conf-agent-connect-timeout-default">12.4.48. agent_connect_timeout</a></span></dt>
  8048. <dt><span class="sect2"><a href="#conf-agent-query-timeout-default">12.4.49. agent_query_timeout</a></span></dt>
  8049. <dt><span class="sect2"><a href="#conf-agent-retry-count">12.4.50. agent_retry_count</a></span></dt>
  8050. <dt><span class="sect2"><a href="#conf-agent-retry-delay">12.4.51. agent_retry_delay</a></span></dt>
  8051. </dl></dd><dt><span class="sect1"><a href="#confgroup-common">12.5. Common section configuration options</a></span></dt>
  8052. <dd><dl><dt><span class="sect2"><a href="#conf-lemmatizer-base">12.5.1. lemmatizer_base</a></span></dt>
  8053. <dt><span class="sect2"><a href="#conf-on-json-attr-error">12.5.2. on_json_attr_error</a></span></dt>
  8054. <dt><span class="sect2"><a href="#conf-json-autoconv-numbers">12.5.3. json_autoconv_numbers</a></span></dt>
  8055. <dt><span class="sect2"><a href="#conf-json-autoconv-keynames">12.5.4. json_autoconv_keynames</a></span></dt>
  8056. <dt><span class="sect2"><a href="#conf-rlp-root">12.5.5. rlp_root</a></span></dt>
  8057. <dt><span class="sect2"><a href="#conf-rlp-environment">12.5.6. rlp_environment</a></span></dt>
  8058. <dt><span class="sect2"><a href="#conf-rlp-max-batch-size">12.5.7. rlp_max_batch_size</a></span></dt>
  8059. <dt><span class="sect2"><a href="#conf-rlp-max-batch-docs">12.5.8. rlp_max_batch_docs</a></span></dt>
  8060. </dl></dd></dl></div>
  8061. <div class="sect1" title="12.1.&nbsp;Data source configuration options"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="confgroup-source"></a>12.1.&nbsp;Data source configuration options</h2></div></div></div>
  8062. <div class="sect2" title="12.1.1.&nbsp;type"><div class="titlepage"><div><div><h3 class="title"><a name="conf-source-type"></a>12.1.1.&nbsp;type</h3></div></div></div>
  8063. <p>
  8064. Data source type.
  8065. Mandatory, no default value.
  8066. Known types are <code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>,
  8067. <code class="option">xmlpipe2</code>, tsvpipe, and <code class="option">odbc</code>.
  8068. </p><p>
  8069. All other per-source options depend on source type selected by this option.
  8070. Names of the options used for SQL sources (ie. MySQL, PostgreSQL, MS SQL) start with "sql_";
  8071. names of the ones used for xmlpipe2 or tsvpipe start with "xmlpipe_" and "tsvpipe_" correspondingly.
  8072. All source types are conditional; they might or might
  8073. not be supported depending on your build settings, installed client libraries, etc.
  8074. <code class="option">mssql</code> type is currently only available on Windows.
  8075. <code class="option">odbc</code> type is available both on Windows natively and on
  8076. Linux through <a class="ulink" href="http://www.unixodbc.org/" target="_top">UnixODBC library</a>.
  8077. </p><h4><a name="idp33017584"></a>Example:</h4><pre class="programlisting">
  8078. type = mysql
  8079. </pre></div>
  8080. <div class="sect2" title="12.1.2.&nbsp;sql_host"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sql-host"></a>12.1.2.&nbsp;sql_host</h3></div></div></div>
  8081. <p>
  8082. SQL server host to connect to.
  8083. Mandatory, no default value.
  8084. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8085. </p><p>
  8086. In the simplest case when Sphinx resides on the same host with your MySQL
  8087. or PostgreSQL installation, you would simply specify "localhost". Note that
  8088. MySQL client library chooses whether to connect over TCP/IP or over UNIX
  8089. socket based on the host name. Specifically "localhost" will force it
  8090. to use UNIX socket (this is the default and generally recommended mode)
  8091. and "127.0.0.1" will force TCP/IP usage. Refer to
  8092. <a class="ulink" href="http://dev.mysql.com/doc/refman/5.0/en/mysql-real-connect.html" target="_top">MySQL manual</a>
  8093. for more details.
  8094. </p><h4><a name="idp33023200"></a>Example:</h4><pre class="programlisting">
  8095. sql_host = localhost
  8096. </pre></div>
  8097. <div class="sect2" title="12.1.3.&nbsp;sql_port"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sql-port"></a>12.1.3.&nbsp;sql_port</h3></div></div></div>
  8098. <p>
  8099. SQL server IP port to connect to.
  8100. Optional, default is 3306 for <code class="option">mysql</code> source type and 5432 for <code class="option">pgsql</code> type.
  8101. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8102. Note that it depends on <a class="link" href="#conf-sql-host" title="12.1.2.&nbsp;sql_host">sql_host</a> setting whether this value will actually be used.
  8103. </p><h4><a name="idp33029072"></a>Example:</h4><pre class="programlisting">
  8104. sql_port = 3306
  8105. </pre></div>
  8106. <div class="sect2" title="12.1.4.&nbsp;sql_user"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sql-user"></a>12.1.4.&nbsp;sql_user</h3></div></div></div>
  8107. <p>
  8108. SQL user to use when connecting to <a class="link" href="#conf-sql-host" title="12.1.2.&nbsp;sql_host">sql_host</a>.
  8109. Mandatory, no default value.
  8110. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8111. </p><h4><a name="idp33033920"></a>Example:</h4><pre class="programlisting">
  8112. sql_user = test
  8113. </pre></div>
  8114. <div class="sect2" title="12.1.5.&nbsp;sql_pass"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sql-pass"></a>12.1.5.&nbsp;sql_pass</h3></div></div></div>
  8115. <p>
  8116. SQL user password to use when connecting to <a class="link" href="#conf-sql-host" title="12.1.2.&nbsp;sql_host">sql_host</a>.
  8117. Mandatory, no default value.
  8118. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8119. </p><h4><a name="idp33038736"></a>Example:</h4><pre class="programlisting">
  8120. sql_pass = mysecretpassword
  8121. </pre></div>
  8122. <div class="sect2" title="12.1.6.&nbsp;sql_db"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sql-db"></a>12.1.6.&nbsp;sql_db</h3></div></div></div>
  8123. <p>
  8124. SQL database (in MySQL terms) to use after the connection and perform further queries within.
  8125. Mandatory, no default value.
  8126. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8127. </p><h4><a name="idp33042848"></a>Example:</h4><pre class="programlisting">
  8128. sql_db = test
  8129. </pre></div>
  8130. <div class="sect2" title="12.1.7.&nbsp;sql_sock"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sql-sock"></a>12.1.7.&nbsp;sql_sock</h3></div></div></div>
  8131. <p>
  8132. UNIX socket name to connect to for local SQL servers.
  8133. Optional, default value is empty (use client library default settings).
  8134. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8135. </p><p>
  8136. On Linux, it would typically be <code class="filename">/var/lib/mysql/mysql.sock</code>.
  8137. On FreeBSD, it would typically be <code class="filename">/tmp/mysql.sock</code>.
  8138. Note that it depends on <a class="link" href="#conf-sql-host" title="12.1.2.&nbsp;sql_host">sql_host</a> setting whether this value will actually be used.
  8139. </p><h4><a name="idp33049728"></a>Example:</h4><pre class="programlisting">
  8140. sql_sock = /tmp/mysql.sock
  8141. </pre></div>
  8142. <div class="sect2" title="12.1.8.&nbsp;mysql_connect_flags"><div class="titlepage"><div><div><h3 class="title"><a name="conf-mysql-connect-flags"></a>12.1.8.&nbsp;mysql_connect_flags</h3></div></div></div>
  8143. <p>
  8144. MySQL client connection flags.
  8145. Optional, default value is 0 (do not set any flags).
  8146. Applies to <code class="option">mysql</code> source type only.
  8147. </p><p>
  8148. This option must contain an integer value with the sum of the flags.
  8149. The value will be passed to <a class="ulink" href="http://dev.mysql.com/doc/refman/5.0/en/mysql-real-connect.html" target="_top">mysql_real_connect()</a> verbatim.
  8150. The flags are enumerated in mysql_com.h include file.
  8151. Flags that are especially interesting in regard to indexing, with their respective values, are as follows:
  8152. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>CLIENT_COMPRESS = 32; can use compression protocol</p></li>
  8153. <li class="listitem"><p>CLIENT_SSL = 2048; switch to SSL after handshake</p></li>
  8154. <li class="listitem"><p>CLIENT_SECURE_CONNECTION = 32768; new 4.1 authentication</p></li>
  8155. </ul></div>
  8156. <p>
  8157. For instance, you can specify 2080 (2048+32) to use both compression and SSL,
  8158. or 32768 to use new authentication only. Initially, this option was introduced
  8159. to be able to use compression when the <code class="filename">indexer</code>
  8160. and <code class="filename">mysqld</code> are on different hosts. Compression on 1 Gbps
  8161. links is most likely to hurt indexing time though it reduces network traffic,
  8162. both in theory and in practice. However, enabling compression on 100 Mbps links
  8163. may improve indexing time significantly (upto 20-30% of the total indexing time
  8164. improvement was reported). Your mileage may vary.
  8165. </p><h4><a name="idp33058432"></a>Example:</h4><pre class="programlisting">
  8166. mysql_connect_flags = 32 # enable compression
  8167. </pre></div>
  8168. <div class="sect2" title="12.1.9.&nbsp;mysql_ssl_cert, mysql_ssl_key, mysql_ssl_ca"><div class="titlepage"><div><div><h3 class="title"><a name="conf-mysql-ssl"></a>12.1.9.&nbsp;mysql_ssl_cert, mysql_ssl_key, mysql_ssl_ca</h3></div></div></div>
  8169. <p>
  8170. SSL certificate settings to use for connecting to MySQL server.
  8171. Optional, default values are empty strings (do not use SSL).
  8172. Applies to <code class="option">mysql</code> source type only.
  8173. </p><p>
  8174. These directives let you set up secure SSL connection between
  8175. <code class="filename">indexer</code> and MySQL. The details on creating
  8176. the certificates and setting up MySQL server can be found in
  8177. MySQL documentation.
  8178. </p><h4><a name="idp33062912"></a>Example:</h4><pre class="programlisting">
  8179. mysql_ssl_cert = /etc/ssl/client-cert.pem
  8180. mysql_ssl_key = /etc/ssl/client-key.pem
  8181. mysql_ssl_ca = /etc/ssl/cacert.pem
  8182. </pre></div>
  8183. <div class="sect2" title="12.1.10.&nbsp;odbc_dsn"><div class="titlepage"><div><div><h3 class="title"><a name="conf-odbc-dsn"></a>12.1.10.&nbsp;odbc_dsn</h3></div></div></div>
  8184. <p>
  8185. ODBC DSN to connect to.
  8186. Mandatory, no default value.
  8187. Applies to <code class="option">odbc</code> source type only.
  8188. </p><p>
  8189. ODBC DSN (Data Source Name) specifies the credentials (host, user, password, etc)
  8190. to use when connecting to ODBC data source. The format depends on specific ODBC
  8191. driver used.
  8192. </p><h4><a name="idp33066640"></a>Example:</h4><pre class="programlisting">
  8193. odbc_dsn = Driver={Oracle ODBC Driver};Dbq=myDBName;Uid=myUsername;Pwd=myPassword
  8194. </pre></div>
  8195. <div class="sect2" title="12.1.11.&nbsp;sql_query_pre"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sql-query-pre"></a>12.1.11.&nbsp;sql_query_pre</h3></div></div></div>
  8196. <p>
  8197. Pre-fetch query, or pre-query.
  8198. Multi-value, optional, default is empty list of queries.
  8199. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8200. </p><p>
  8201. Multi-value means that you can specify several pre-queries.
  8202. They are executed before <a class="link" href="#conf-sql-query" title="12.1.12.&nbsp;sql_query">the main fetch query</a>,
  8203. and they will be executed exactly in order of appearance in the configuration file.
  8204. Pre-query results are ignored.
  8205. </p><p>
  8206. Pre-queries are useful in a lot of ways. They are used to setup encoding,
  8207. mark records that are going to be indexed, update internal counters,
  8208. set various per-connection SQL server options and variables, and so on.
  8209. </p><p>
  8210. Perhaps the most frequent pre-query usage is to specify the encoding
  8211. that the server will use for the rows it returns. Note that Sphinx accepts
  8212. only UTF-8 texts.
  8213. Two MySQL specific examples of setting the encoding are:
  8214. </p><pre class="programlisting">
  8215. sql_query_pre = SET CHARACTER_SET_RESULTS=utf8
  8216. sql_query_pre = SET NAMES utf8
  8217. </pre><p>
  8218. Also specific to MySQL sources, it is useful to disable query cache
  8219. (for indexer connection only) in pre-query, because indexing queries
  8220. are not going to be re-run frequently anyway, and there's no sense
  8221. in caching their results. That could be achieved with:
  8222. </p><pre class="programlisting">
  8223. sql_query_pre = SET SESSION query_cache_type=OFF
  8224. </pre><p>
  8225. </p><h4><a name="idp33075104"></a>Example:</h4><pre class="programlisting">
  8226. sql_query_pre = SET NAMES utf8
  8227. sql_query_pre = SET SESSION query_cache_type=OFF
  8228. </pre></div>
  8229. <div class="sect2" title="12.1.12.&nbsp;sql_query"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sql-query"></a>12.1.12.&nbsp;sql_query</h3></div></div></div>
  8230. <p>
  8231. Main document fetch query.
  8232. Mandatory, no default value.
  8233. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8234. </p><p>
  8235. There can be only one main query.
  8236. This is the query which is used to retrieve documents from SQL server.
  8237. You can specify up to 32 full-text fields (formally, upto SPH_MAX_FIELDS from sphinx.h), and an arbitrary amount of attributes.
  8238. All of the columns that are neither document ID (the first one) nor attributes will be full-text indexed.
  8239. </p><p>
  8240. Document ID <span class="bold"><strong>MUST</strong></span> be the very first field,
  8241. and it <span class="bold"><strong>MUST BE UNIQUE UNSIGNED POSITIVE (NON-ZERO, NON-NEGATIVE) INTEGER NUMBER</strong></span>.
  8242. It can be either 32-bit or 64-bit, depending on how you built Sphinx;
  8243. by default it builds with 32-bit IDs support but <code class="option">--enable-id64</code> option
  8244. to <code class="filename">configure</code> allows to build with 64-bit document and word IDs support.
  8245. </p><h4><a name="idp33083488"></a>Example:</h4><pre class="programlisting">
  8246. sql_query = \
  8247. SELECT id, group_id, UNIX_TIMESTAMP(date_added) AS date_added, \
  8248. title, content \
  8249. FROM documents
  8250. </pre></div>
  8251. <div class="sect2" title="12.1.13.&nbsp;sql_joined_field"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sql-joined-field"></a>12.1.13.&nbsp;sql_joined_field</h3></div></div></div>
  8252. <p>
  8253. Joined/payload field fetch query.
  8254. Multi-value, optional, default is empty list of queries.
  8255. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8256. </p><p>
  8257. <code class="option">sql_joined_field</code> lets you use two different features:
  8258. joined fields, and payloads (payload fields). It's syntax is as follows:
  8259. </p><pre class="programlisting">
  8260. sql_joined_field = FIELD-NAME 'from' ( 'query' | 'payload-query' \
  8261. | 'ranged-query' ); QUERY [ ; RANGE-QUERY ]
  8262. </pre><p>
  8263. where
  8264. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>FIELD-NAME is a joined/payload field name;</p></li>
  8265. <li class="listitem"><p>QUERY is an SQL query that must fetch values to index.</p></li>
  8266. <li class="listitem"><p>RANGE-QUERY is an optional SQL query that fetches a range
  8267. of values to index. (Added in version 2.0.1-beta.)</p></li>
  8268. </ul></div>
  8269. <p>
  8270. </p><p>
  8271. <span class="bold"><strong>Joined fields</strong></span> let you avoid JOIN and/or GROUP_CONCAT statements in the main
  8272. document fetch query (sql_query). This can be useful when SQL-side JOIN is slow,
  8273. or needs to be offloaded on Sphinx side, or simply to emulate MySQL-specific
  8274. GROUP_CONCAT functionality in case your database server does not support it.
  8275. </p><p>
  8276. The query must return exactly 2 columns: document ID, and text to append
  8277. to a joined field. Document IDs can be duplicate, but they <span class="bold"><strong>must</strong></span> be
  8278. in ascending order. All the text rows fetched for a given ID will be
  8279. concatenated together, and the concatenation result will be indexed
  8280. as the entire contents of a joined field. Rows will be concatenated
  8281. in the order returned from the query, and separating whitespace
  8282. will be inserted between them. For instance, if joined field query
  8283. returns the following rows:
  8284. </p><pre class="programlisting">
  8285. ( 1, 'red' )
  8286. ( 1, 'right' )
  8287. ( 1, 'hand' )
  8288. ( 2, 'mysql' )
  8289. ( 2, 'sphinx' )
  8290. </pre><p>
  8291. then the indexing results would be equivalent to that of adding
  8292. a new text field with a value of 'red right hand' to document 1 and
  8293. 'mysql sphinx' to document 2.
  8294. </p><p>
  8295. Joined fields are only indexed differently. There are no other differences
  8296. between joined fields and regular text fields.
  8297. </p><p>
  8298. Starting with 2.0.1-beta, <span class="bold"><strong>ranged queries</strong></span> can be used when
  8299. a single query is not efficient enough or does not work because of
  8300. the database driver limitations. It works similar to the ranged
  8301. queries in the main indexing loop, see <a class="xref" href="#ranged-queries" title="3.8.&nbsp;Ranged queries">Section&nbsp;3.8, &#8220;Ranged queries&#8221;</a>.
  8302. The range will be queried for and fetched upfront once,
  8303. then multiple queries with different <code class="code">$start</code>
  8304. and <code class="code">$end</code> substitutions will be run to fetch
  8305. the actual data.
  8306. </p><p>
  8307. <span class="bold"><strong>Payloads</strong></span> let you create a special field in which, instead of
  8308. keyword positions, so-called user payloads are stored. Payloads are
  8309. custom integer values attached to every keyword. They can then be used
  8310. in search time to affect the ranking.
  8311. </p><p>
  8312. The payload query must return exactly 3 columns: document ID; keyword;
  8313. and integer payload value. Document IDs can be duplicate, but they <span class="bold"><strong>must</strong></span> be
  8314. in ascending order. Payloads must be unsigned integers within 24-bit range,
  8315. ie. from 0 to 16777215. For reference, payloads are currently internally
  8316. stored as in-field keyword positions, but that is not guaranteed
  8317. and might change in the future.
  8318. </p><p>
  8319. Currently, the only method to account for payloads is to use
  8320. SPH_RANK_PROXIMITY_BM25 ranker. On indexes with payload fields,
  8321. it will automatically switch to a variant that matches keywords
  8322. in those fields, computes a sum of matched payloads multiplied
  8323. by field weights, and adds that sum to the final rank.
  8324. </p><h4><a name="idp33102560"></a>Example:</h4><pre class="programlisting">
  8325. sql_joined_field = \
  8326. tagstext from query; \
  8327. SELECT docid, CONCAT('tag',tagid) FROM tags ORDER BY docid ASC
  8328. sql_joined_field = bigint tag from ranged-query; \
  8329. SELECT id, tag FROM tags WHERE id&gt;=$start AND id&lt;=$end; \
  8330. SELECT MIN(id), MAX(id) FROM tags ORDER BY docid ASC
  8331. </pre></div>
  8332. <div class="sect2" title="12.1.14.&nbsp;sql_query_range"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sql-query-range"></a>12.1.14.&nbsp;sql_query_range</h3></div></div></div>
  8333. <p>
  8334. Range query setup.
  8335. Optional, default is empty.
  8336. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8337. </p><p>
  8338. Setting this option enables ranged document fetch queries (see <a class="xref" href="#ranged-queries" title="3.8.&nbsp;Ranged queries">Section&nbsp;3.8, &#8220;Ranged queries&#8221;</a>).
  8339. Ranged queries are useful to avoid notorious MyISAM table locks when indexing
  8340. lots of data. (They also help with other less notorious issues, such as reduced
  8341. performance caused by big result sets, or additional resources consumed by InnoDB
  8342. to serialize big read transactions.)
  8343. </p><p>
  8344. The query specified in this option must fetch min and max document IDs that will be
  8345. used as range boundaries. It must return exactly two integer fields, min ID first
  8346. and max ID second; the field names are ignored.
  8347. </p><p>
  8348. When ranged queries are enabled, <a class="link" href="#conf-sql-query" title="12.1.12.&nbsp;sql_query">sql_query</a>
  8349. will be required to contain <code class="option">$start</code> and <code class="option">$end</code> macros
  8350. (because it obviously would be a mistake to index the whole table many times over).
  8351. Note that the intervals specified by <code class="option">$start</code>..<code class="option">$end</code>
  8352. will not overlap, so you should <span class="bold"><strong>not</strong></span> remove document IDs that are
  8353. exactly equal to <code class="option">$start</code> or <code class="option">$end</code> from your query.
  8354. The example in <a class="xref" href="#ranged-queries" title="3.8.&nbsp;Ranged queries">Section&nbsp;3.8, &#8220;Ranged queries&#8221;</a>) illustrates that; note how it
  8355. uses greater-or-equal and less-or-equal comparisons.
  8356. </p><h4><a name="idp33114560"></a>Example:</h4><pre class="programlisting">
  8357. sql_query_range = SELECT MIN(id),MAX(id) FROM documents
  8358. </pre></div>
  8359. <div class="sect2" title="12.1.15.&nbsp;sql_range_step"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sql-range-step"></a>12.1.15.&nbsp;sql_range_step</h3></div></div></div>
  8360. <p>
  8361. Range query step.
  8362. Optional, default is 1024.
  8363. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8364. </p><p>
  8365. Only used when <a class="link" href="#ranged-queries" title="3.8.&nbsp;Ranged queries">ranged queries</a> are enabled.
  8366. The full document IDs interval fetched by <a class="link" href="#conf-sql-query-range" title="12.1.14.&nbsp;sql_query_range">sql_query_range</a>
  8367. will be walked in this big steps. For example, if min and max IDs fetched
  8368. are 12 and 3456 respectively, and the step is 1000, indexer will call
  8369. <a class="link" href="#conf-sql-query" title="12.1.12.&nbsp;sql_query">sql_query</a> several times with the
  8370. following substitutions:
  8371. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>$start=12, $end=1011</p></li>
  8372. <li class="listitem"><p>$start=1012, $end=2011</p></li>
  8373. <li class="listitem"><p>$start=2012, $end=3011</p></li>
  8374. <li class="listitem"><p>$start=3012, $end=3456</p></li>
  8375. </ul></div>
  8376. <p>
  8377. </p><h4><a name="idp33124224"></a>Example:</h4><pre class="programlisting">
  8378. sql_range_step = 1000
  8379. </pre></div>
  8380. <div class="sect2" title="12.1.16.&nbsp;sql_query_killlist"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sql-query-killlist"></a>12.1.16.&nbsp;sql_query_killlist</h3></div></div></div>
  8381. <p>
  8382. Kill-list query.
  8383. Optional, default is empty (no query).
  8384. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8385. Introduced in version 0.9.9-rc1.
  8386. </p><p>
  8387. This query is expected to return a number of 1-column rows, each containing
  8388. just the document ID. The returned document IDs are stored within an index.
  8389. Kill-list for a given index suppresses results from <span class="emphasis"><em>other</em></span>
  8390. indexes, depending on index order in the query. The intended use is to help
  8391. implement deletions and updates on existing indexes without rebuilding
  8392. (actually even touching them), and especially to fight phantom results
  8393. problem.
  8394. </p><p>
  8395. Let us dissect an example. Assume we have two indexes, 'main' and 'delta'.
  8396. Assume that documents 2, 3, and 5 were deleted since last reindex of 'main',
  8397. and documents 7 and 11 were updated (ie. their text contents were changed).
  8398. Assume that a keyword 'test' occurred in all these mentioned documents
  8399. when we were indexing 'main'; still occurs in document 7 as we index 'delta';
  8400. but does not occur in document 11 any more. We now reindex delta and then
  8401. search through both these indexes in proper (least to most recent) order:
  8402. </p><pre class="programlisting">
  8403. $res = $cl-&gt;Query ( "test", "main delta" );
  8404. </pre><p>
  8405. </p><p>
  8406. First, we need to properly handle deletions. The result set should not
  8407. contain documents 2, 3, or 5. Second, we also need to avoid phantom results.
  8408. Unless we do something about it, document 11 <span class="emphasis"><em>will</em></span>
  8409. appear in search results! It will be found in 'main' (but not 'delta').
  8410. And it will make it to the final result set unless something stops it.
  8411. </p><p>
  8412. Kill-list, or K-list for short, is that something. Kill-list attached
  8413. to 'delta' will suppress the specified rows from <span class="bold"><strong>all</strong></span> the preceding
  8414. indexes, in this case just 'main'. So to get the expected results,
  8415. we should put all the updated <span class="emphasis"><em>and</em></span> deleted
  8416. document IDs into it.
  8417. </p><p>
  8418. Note that in the distributed index setup, K-lists are <span class="bold"><strong>local
  8419. to every node in the cluster</strong></span>. They are <span class="bold"><strong>not</strong></span> get transmitted
  8420. over the network when sending queries. (Because that might be too much
  8421. of an impact when the K-list is huge.) You will need to setup a
  8422. separate per-server K-lists in that case.
  8423. </p><h4><a name="idp33136032"></a>Example:</h4><pre class="programlisting">
  8424. sql_query_killlist = \
  8425. SELECT id FROM documents WHERE updated_ts&gt;=@last_reindex UNION \
  8426. SELECT id FROM documents_deleted WHERE deleted_ts&gt;=@last_reindex
  8427. </pre></div>
  8428. <div class="sect2" title="12.1.17.&nbsp;sql_attr_uint"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sql-attr-uint"></a>12.1.17.&nbsp;sql_attr_uint</h3></div></div></div>
  8429. <p>
  8430. Unsigned integer <a class="link" href="#attributes" title="3.3.&nbsp;Attributes">attribute</a> declaration.
  8431. Multi-value (there might be multiple attributes declared), optional.
  8432. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8433. </p><p>
  8434. The column value should fit into 32-bit unsigned integer range.
  8435. Values outside this range will be accepted but wrapped around.
  8436. For instance, -1 will be wrapped around to 2^32-1 or 4,294,967,295.
  8437. </p><p>
  8438. You can specify bit count for integer attributes by appending
  8439. ':BITCOUNT' to attribute name (see example below). Attributes with
  8440. less than default 32-bit size, or bitfields, perform slower.
  8441. But they require less RAM when using <a class="link" href="#conf-docinfo" title="12.2.4.&nbsp;docinfo">extern storage</a>:
  8442. such bitfields are packed together in 32-bit chunks in <code class="filename">.spa</code>
  8443. attribute data file. Bit size settings are ignored if using
  8444. <a class="link" href="#conf-docinfo" title="12.2.4.&nbsp;docinfo">inline storage</a>.
  8445. </p><h4><a name="idp33144720"></a>Example:</h4><pre class="programlisting">
  8446. sql_attr_uint = group_id
  8447. sql_attr_uint = forum_id:9 # 9 bits for forum_id
  8448. </pre></div>
  8449. <div class="sect2" title="12.1.18.&nbsp;sql_attr_bool"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sql-attr-bool"></a>12.1.18.&nbsp;sql_attr_bool</h3></div></div></div>
  8450. <p>
  8451. Boolean <a class="link" href="#attributes" title="3.3.&nbsp;Attributes">attribute</a> declaration.
  8452. Multi-value (there might be multiple attributes declared), optional.
  8453. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8454. Equivalent to <a class="link" href="#conf-sql-attr-uint" title="12.1.17.&nbsp;sql_attr_uint">sql_attr_uint</a> declaration with a bit count of 1.
  8455. </p><h4><a name="idp33150576"></a>Example:</h4><pre class="programlisting">
  8456. sql_attr_bool = is_deleted # will be packed to 1 bit
  8457. </pre></div>
  8458. <div class="sect2" title="12.1.19.&nbsp;sql_attr_bigint"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sql-attr-bigint"></a>12.1.19.&nbsp;sql_attr_bigint</h3></div></div></div>
  8459. <p>
  8460. 64-bit signed integer <a class="link" href="#attributes" title="3.3.&nbsp;Attributes">attribute</a> declaration.
  8461. Multi-value (there might be multiple attributes declared), optional.
  8462. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8463. Note that unlike <a class="link" href="#conf-sql-attr-uint" title="12.1.17.&nbsp;sql_attr_uint">sql_attr_uint</a>,
  8464. these values are <span class="bold"><strong>signed</strong></span>.
  8465. Introduced in version 0.9.9-rc1.
  8466. </p><h4><a name="idp33157008"></a>Example:</h4><pre class="programlisting">
  8467. sql_attr_bigint = my_bigint_id
  8468. </pre></div>
  8469. <div class="sect2" title="12.1.20.&nbsp;sql_attr_timestamp"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sql-attr-timestamp"></a>12.1.20.&nbsp;sql_attr_timestamp</h3></div></div></div>
  8470. <p>
  8471. UNIX timestamp <a class="link" href="#attributes" title="3.3.&nbsp;Attributes">attribute</a> declaration.
  8472. Multi-value (there might be multiple attributes declared), optional.
  8473. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8474. </p><p>
  8475. Timestamps can store date and time in the range of Jan 01, 1970
  8476. to Jan 19, 2038 with a precision of one second.
  8477. The expected column value should be a timestamp in UNIX format, ie. 32-bit unsigned
  8478. integer number of seconds elapsed since midnight, January 01, 1970, GMT.
  8479. Timestamps are internally stored and handled as integers everywhere.
  8480. But in addition to working with timestamps as integers, it's also legal
  8481. to use them along with different date-based functions, such as time segments
  8482. sorting mode, or day/week/month/year extraction for GROUP BY.
  8483. </p><p>
  8484. Note that DATE or DATETIME column types in MySQL can <span class="bold"><strong>not</strong></span> be directly
  8485. used as timestamp attributes in Sphinx; you need to explicitly convert such
  8486. columns using UNIX_TIMESTAMP function (if data is in range).
  8487. </p><p>
  8488. Note timestamps can not represent dates before January 01, 1970,
  8489. and UNIX_TIMESTAMP() in MySQL will not return anything expected.
  8490. If you only needs to work with dates, not times, consider TO_DAYS()
  8491. function in MySQL instead.
  8492. </p><h4><a name="idp33164624"></a>Example:</h4><pre class="programlisting">
  8493. # sql_query = ... UNIX_TIMESTAMP(added_datetime) AS added_ts ...
  8494. sql_attr_timestamp = added_ts
  8495. </pre></div>
  8496. <div class="sect2" title="12.1.21.&nbsp;sql_attr_float"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sql-attr-float"></a>12.1.21.&nbsp;sql_attr_float</h3></div></div></div>
  8497. <p>
  8498. Floating point <a class="link" href="#attributes" title="3.3.&nbsp;Attributes">attribute</a> declaration.
  8499. Multi-value (there might be multiple attributes declared), optional.
  8500. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8501. </p><p>
  8502. The values will be stored in single precision, 32-bit IEEE 754 format.
  8503. Represented range is approximately from 1e-38 to 1e+38. The amount
  8504. of decimal digits that can be stored precisely is approximately 7.
  8505. One important usage of the float attributes is storing latitude
  8506. and longitude values (in radians), for further usage in query-time
  8507. geosphere distance calculations.
  8508. </p><h4><a name="idp33170288"></a>Example:</h4><pre class="programlisting">
  8509. sql_attr_float = lat_radians
  8510. sql_attr_float = long_radians
  8511. </pre></div>
  8512. <div class="sect2" title="12.1.22.&nbsp;sql_attr_multi"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sql-attr-multi"></a>12.1.22.&nbsp;sql_attr_multi</h3></div></div></div>
  8513. <p>
  8514. <a class="link" href="#mva" title="3.4.&nbsp;MVA (multi-valued attributes)">Multi-valued attribute</a> (MVA) declaration.
  8515. Multi-value (ie. there may be more than one such attribute declared), optional.
  8516. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8517. </p><p>
  8518. Plain attributes only allow to attach 1 value per each document.
  8519. However, there are cases (such as tags or categories) when it is
  8520. desired to attach multiple values of the same attribute and be able
  8521. to apply filtering or grouping to value lists.
  8522. </p><p>
  8523. The declaration format is as follows (backslashes are for clarity only;
  8524. everything can be declared in a single line as well):
  8525. </p><pre class="programlisting">
  8526. sql_attr_multi = ATTR-TYPE ATTR-NAME 'from' SOURCE-TYPE \
  8527. [;QUERY] \
  8528. [;RANGE-QUERY]
  8529. </pre><p>
  8530. where
  8531. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>ATTR-TYPE is 'uint', 'bigint' or 'timestamp'</p></li>
  8532. <li class="listitem"><p>SOURCE-TYPE is 'field', 'query', or 'ranged-query'</p></li>
  8533. <li class="listitem"><p>QUERY is SQL query used to fetch all ( docid, attrvalue ) pairs</p></li>
  8534. <li class="listitem"><p>RANGE-QUERY is SQL query used to fetch min and max ID values, similar to 'sql_query_range'</p></li>
  8535. </ul></div>
  8536. <p>
  8537. </p><h4><a name="idp33179840"></a>Example:</h4><pre class="programlisting">
  8538. sql_attr_multi = uint tag from query; SELECT id, tag FROM tags
  8539. sql_attr_multi = bigint tag from ranged-query; \
  8540. SELECT id, tag FROM tags WHERE id&gt;=$start AND id&lt;=$end; \
  8541. SELECT MIN(id), MAX(id) FROM tags
  8542. </pre></div>
  8543. <div class="sect2" title="12.1.23.&nbsp;sql_attr_string"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sql-attr-string"></a>12.1.23.&nbsp;sql_attr_string</h3></div></div></div>
  8544. <p>
  8545. String attribute declaration.
  8546. Multi-value (ie. there may be more than one such attribute declared), optional.
  8547. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8548. Introduced in version 1.10-beta.
  8549. </p><p>
  8550. String attributes can store arbitrary strings attached to every document.
  8551. There's a fixed size limit of 4 MB per value. Also, <code class="filename">searchd</code>
  8552. will currently cache all the values in RAM, which is an additional implicit limit.
  8553. </p><p>
  8554. Starting from 2.0.1-beta string attributes can be used for sorting and
  8555. grouping(ORDER BY, GROUP BY, WITHIN GROUP ORDER BY). Note that attributes
  8556. declared using <code class="option">sql_attr_string</code> will <span class="bold"><strong>not</strong></span> be full-text
  8557. indexed; you can use <a class="link" href="#conf-sql-field-string" title="12.1.26.&nbsp;sql_field_string">sql_field_string</a>
  8558. directive for that.
  8559. </p><h4><a name="idp33188160"></a>Example:</h4><pre class="programlisting">
  8560. sql_attr_string = title # will be stored but will not be indexed
  8561. </pre></div>
  8562. <div class="sect2" title="12.1.24.&nbsp;sql_attr_json"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sql-attr-json"></a>12.1.24.&nbsp;sql_attr_json</h3></div></div></div>
  8563. <p>
  8564. JSON attribute declaration.
  8565. Multi-value (ie. there may be more than one such attribute declared), optional.
  8566. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8567. Introduced in version 2.1.1-beta.
  8568. </p><p>
  8569. When indexing JSON attributes, Sphinx expects a text field
  8570. with JSON formatted data. As of 2.2.1-beta JSON attributes supports arbitrary
  8571. JSON data with no limitation in nested levels or types.
  8572. </p><pre class="programlisting">
  8573. {
  8574. "id": 1,
  8575. "gid": 2,
  8576. "title": "some title",
  8577. "tags": [
  8578. "tag1",
  8579. "tag2",
  8580. "tag3"
  8581. {
  8582. "one": "two",
  8583. "three": [4, 5]
  8584. }
  8585. ]
  8586. }
  8587. </pre><p>
  8588. These attributes allow Sphinx to work with documents without a fixed set of
  8589. attribute columns. When you filter on a key of a JSON attribute, documents
  8590. that don't include the key will simply be ignored.
  8591. </p><p>
  8592. You can read more on JSON attributes in <a class="ulink" href="http://sphinxsearch.com/blog/2013/08/08/full-json-support-in-trunk/" target="_top">
  8593. http://sphinxsearch.com/blog/2013/08/08/full-json-support-in-trunk/</a>.
  8594. </p><h4><a name="idp33195168"></a>Example:</h4><pre class="programlisting">
  8595. sql_attr_json = properties
  8596. </pre></div>
  8597. <div class="sect2" title="12.1.25.&nbsp;sql_column_buffers"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sql-column-buffers"></a>12.1.25.&nbsp;sql_column_buffers</h3></div></div></div>
  8598. <p>
  8599. Per-column buffer sizes.
  8600. Optional, default is empty (deduce the sizes automatically).
  8601. Applies to <code class="option">odbc</code>, <code class="option">mssql</code> source types only.
  8602. Introduced in version 2.0.1-beta.
  8603. </p><p>
  8604. ODBC and MS SQL drivers sometimes can not return the maximum
  8605. actual column size to be expected. For instance, NVARCHAR(MAX) columns
  8606. always report their length as 2147483647 bytes to
  8607. <code class="filename">indexer</code> even though the actually used length
  8608. is likely considerably less. However, the receiving buffers still
  8609. need to be allocated upfront, and their sizes have to be determined.
  8610. When the driver does not report the column length at all, Sphinx
  8611. allocates default 1 KB buffers for each non-char column, and 1 MB
  8612. buffers for each char column. Driver-reported column length
  8613. also gets clamped by an upper limit of 8 MB, so in case the
  8614. driver reports (almost) a 2 GB column length, it will be clamped
  8615. and a 8 MB buffer will be allocated instead for that column.
  8616. These hard-coded limits can be overridden using the
  8617. <code class="code">sql_column_buffers</code> directive, either in order
  8618. to save memory on actually shorter columns, or overcome
  8619. the 8 MB limit on actually longer columns. The directive values
  8620. must be a comma-separated lists of selected column names and sizes:
  8621. </p><pre class="programlisting">
  8622. sql_column_buffers = &lt;colname&gt;=&lt;size&gt;[K|M] [, ...]
  8623. </pre><p>
  8624. </p><h4><a name="idp33202656"></a>Example:</h4><pre class="programlisting">
  8625. sql_query = SELECT id, mytitle, mycontent FROM documents
  8626. sql_column_buffers = mytitle=64K, mycontent=10M
  8627. </pre></div>
  8628. <div class="sect2" title="12.1.26.&nbsp;sql_field_string"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sql-field-string"></a>12.1.26.&nbsp;sql_field_string</h3></div></div></div>
  8629. <p>
  8630. Combined string attribute and full-text field declaration.
  8631. Multi-value (ie. there may be more than one such attribute declared), optional.
  8632. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8633. Introduced in version 1.10-beta.
  8634. </p><p>
  8635. <a class="link" href="#conf-sql-attr-string" title="12.1.23.&nbsp;sql_attr_string">sql_attr_string</a> only stores the column
  8636. value but does not full-text index it. In some cases it might be desired to both full-text
  8637. index the column and store it as attribute. <code class="option">sql_field_string</code> lets you do
  8638. exactly that. Both the field and the attribute will be named the same.
  8639. </p><h4><a name="idp33208768"></a>Example:</h4><pre class="programlisting">
  8640. sql_field_string = title # will be both indexed and stored
  8641. </pre></div>
  8642. <div class="sect2" title="12.1.27.&nbsp;sql_file_field"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sql-file-field"></a>12.1.27.&nbsp;sql_file_field</h3></div></div></div>
  8643. <p>
  8644. File based field declaration.
  8645. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8646. Introduced in version 1.10-beta.
  8647. </p><p>
  8648. This directive makes <code class="filename">indexer</code> interpret field contents
  8649. as a file name, and load and index the referred file. Files larger than
  8650. <a class="link" href="#conf-max-file-field-buffer" title="12.3.6.&nbsp;max_file_field_buffer">max_file_field_buffer</a>
  8651. in size are skipped. Any errors during the file loading (IO errors, missed
  8652. limits, etc) will be reported as indexing warnings and will <span class="bold"><strong>not</strong></span> early
  8653. terminate the indexing. No content will be indexed for such files.
  8654. </p><h4><a name="idp33215968"></a>Example:</h4><pre class="programlisting">
  8655. sql_file_field = my_file_path # load and index files referred to by my_file_path
  8656. </pre></div>
  8657. <div class="sect2" title="12.1.28.&nbsp;sql_query_post"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sql-query-post"></a>12.1.28.&nbsp;sql_query_post</h3></div></div></div>
  8658. <p>
  8659. Post-fetch query.
  8660. Optional, default value is empty.
  8661. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8662. </p><p>
  8663. This query is executed immediately after <a class="link" href="#conf-sql-query" title="12.1.12.&nbsp;sql_query">sql_query</a>
  8664. completes successfully. When post-fetch query produces errors,
  8665. they are reported as warnings, but indexing is <span class="bold"><strong>not</strong></span> terminated.
  8666. It's result set is ignored. Note that indexing is <span class="bold"><strong>not</strong></span> yet completed
  8667. at the point when this query gets executed, and further indexing still may fail.
  8668. Therefore, any permanent updates should not be done from here.
  8669. For instance, updates on helper table that permanently change
  8670. the last successfully indexed ID should not be run from post-fetch
  8671. query; they should be run from <a class="link" href="#conf-sql-query-post-index" title="12.1.29.&nbsp;sql_query_post_index">post-index query</a> instead.
  8672. </p><h4><a name="idp33223904"></a>Example:</h4><pre class="programlisting">
  8673. sql_query_post = DROP TABLE my_tmp_table
  8674. </pre></div>
  8675. <div class="sect2" title="12.1.29.&nbsp;sql_query_post_index"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sql-query-post-index"></a>12.1.29.&nbsp;sql_query_post_index</h3></div></div></div>
  8676. <p>
  8677. Post-index query.
  8678. Optional, default value is empty.
  8679. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8680. </p><p>
  8681. This query is executed when indexing is fully and successfully completed.
  8682. If this query produces errors, they are reported as warnings,
  8683. but indexing is <span class="bold"><strong>not</strong></span> terminated. It's result set is ignored.
  8684. <code class="code">$maxid</code> macro can be used in its text; it will be
  8685. expanded to maximum document ID which was actually fetched
  8686. from the database during indexing. If no documents were indexed,
  8687. $maxid will be expanded to 0.
  8688. </p><h4><a name="idp33229808"></a>Example:</h4><pre class="programlisting">
  8689. sql_query_post_index = REPLACE INTO counters ( id, val ) \
  8690. VALUES ( 'max_indexed_id', $maxid )
  8691. </pre></div>
  8692. <div class="sect2" title="12.1.30.&nbsp;sql_ranged_throttle"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sql-ranged-throttle"></a>12.1.30.&nbsp;sql_ranged_throttle</h3></div></div></div>
  8693. <p>
  8694. Ranged query throttling period, in milliseconds.
  8695. Optional, default is 0 (no throttling).
  8696. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8697. </p><p>
  8698. Throttling can be useful when indexer imposes too much load on the
  8699. database server. It causes the indexer to sleep for given amount of
  8700. milliseconds once per each ranged query step. This sleep is unconditional,
  8701. and is performed before the fetch query.
  8702. </p><h4><a name="idp33234608"></a>Example:</h4><pre class="programlisting">
  8703. sql_ranged_throttle = 1000 # sleep for 1 sec before each query step
  8704. </pre></div>
  8705. <div class="sect2" title="12.1.31.&nbsp;xmlpipe_command"><div class="titlepage"><div><div><h3 class="title"><a name="conf-xmlpipe-command"></a>12.1.31.&nbsp;xmlpipe_command</h3></div></div></div>
  8706. <p>
  8707. Shell command that invokes xmlpipe2 stream producer.
  8708. Mandatory.
  8709. Applies to <code class="option">xmlpipe2</code> source types only.
  8710. </p><p>
  8711. Specifies a command that will be executed and which output
  8712. will be parsed for documents. Refer to <a class="xref" href="#xmlpipe2" title="3.9.&nbsp;xmlpipe2 data source">Section&nbsp;3.9, &#8220;xmlpipe2 data source&#8221;</a> for specific format description.
  8713. </p><h4><a name="idp33239008"></a>Example:</h4><pre class="programlisting">
  8714. xmlpipe_command = cat /home/sphinx/test.xml
  8715. </pre></div>
  8716. <div class="sect2" title="12.1.32.&nbsp;xmlpipe_field"><div class="titlepage"><div><div><h3 class="title"><a name="conf-xmlpipe-field"></a>12.1.32.&nbsp;xmlpipe_field</h3></div></div></div>
  8717. <p>
  8718. xmlpipe field declaration.
  8719. Multi-value, optional.
  8720. Applies to <code class="option">xmlpipe2</code> source type only. Refer to <a class="xref" href="#xmlpipe2" title="3.9.&nbsp;xmlpipe2 data source">Section&nbsp;3.9, &#8220;xmlpipe2 data source&#8221;</a>.
  8721. </p><h4><a name="idp33242864"></a>Example:</h4><pre class="programlisting">
  8722. xmlpipe_field = subject
  8723. xmlpipe_field = content
  8724. </pre></div>
  8725. <div class="sect2" title="12.1.33.&nbsp;xmlpipe_field_string"><div class="titlepage"><div><div><h3 class="title"><a name="conf-xmlpipe-field-string"></a>12.1.33.&nbsp;xmlpipe_field_string</h3></div></div></div>
  8726. <p>
  8727. xmlpipe field and string attribute declaration.
  8728. Multi-value, optional.
  8729. Applies to <code class="option">xmlpipe2</code> source type only. Refer to <a class="xref" href="#xmlpipe2" title="3.9.&nbsp;xmlpipe2 data source">Section&nbsp;3.9, &#8220;xmlpipe2 data source&#8221;</a>.
  8730. Introduced in version 1.10-beta.
  8731. </p><p>
  8732. Makes the specified XML element indexed as both a full-text field and a string attribute.
  8733. Equivalent to &lt;sphinx:field name="field" attr="string"/&gt; declaration within the XML file.
  8734. </p><h4><a name="idp33247568"></a>Example:</h4><pre class="programlisting">
  8735. xmlpipe_field_string = subject
  8736. </pre></div>
  8737. <div class="sect2" title="12.1.34.&nbsp;xmlpipe_attr_uint"><div class="titlepage"><div><div><h3 class="title"><a name="conf-xmlpipe-attr-uint"></a>12.1.34.&nbsp;xmlpipe_attr_uint</h3></div></div></div>
  8738. <p>
  8739. xmlpipe integer attribute declaration.
  8740. Multi-value, optional.
  8741. Applies to <code class="option">xmlpipe2</code> source type only.
  8742. Syntax fully matches that of <a class="link" href="#conf-sql-attr-uint" title="12.1.17.&nbsp;sql_attr_uint">sql_attr_uint</a>.
  8743. </p><h4><a name="idp33251392"></a>Example:</h4><pre class="programlisting">
  8744. xmlpipe_attr_uint = author_id
  8745. </pre></div>
  8746. <div class="sect2" title="12.1.35.&nbsp;xmlpipe_attr_bigint"><div class="titlepage"><div><div><h3 class="title"><a name="conf-xmlpipe-attr-bigint"></a>12.1.35.&nbsp;xmlpipe_attr_bigint</h3></div></div></div>
  8747. <p>
  8748. xmlpipe signed 64-bit integer attribute declaration.
  8749. Multi-value, optional.
  8750. Applies to <code class="option">xmlpipe2</code> source type only.
  8751. Syntax fully matches that of <a class="link" href="#conf-sql-attr-bigint" title="12.1.19.&nbsp;sql_attr_bigint">sql_attr_bigint</a>.
  8752. </p><h4><a name="idp33255600"></a>Example:</h4><pre class="programlisting">
  8753. xmlpipe_attr_bigint = my_bigint_id
  8754. </pre></div>
  8755. <div class="sect2" title="12.1.36.&nbsp;xmlpipe_attr_bool"><div class="titlepage"><div><div><h3 class="title"><a name="conf-xmlpipe-attr-bool"></a>12.1.36.&nbsp;xmlpipe_attr_bool</h3></div></div></div>
  8756. <p>
  8757. xmlpipe boolean attribute declaration.
  8758. Multi-value, optional.
  8759. Applies to <code class="option">xmlpipe2</code> source type only.
  8760. Syntax fully matches that of <a class="link" href="#conf-sql-attr-bool" title="12.1.18.&nbsp;sql_attr_bool">sql_attr_bool</a>.
  8761. </p><h4><a name="idp33259760"></a>Example:</h4><pre class="programlisting">
  8762. xmlpipe_attr_bool = is_deleted # will be packed to 1 bit
  8763. </pre></div>
  8764. <div class="sect2" title="12.1.37.&nbsp;xmlpipe_attr_timestamp"><div class="titlepage"><div><div><h3 class="title"><a name="conf-xmlpipe-attr-timestamp"></a>12.1.37.&nbsp;xmlpipe_attr_timestamp</h3></div></div></div>
  8765. <p>
  8766. xmlpipe UNIX timestamp attribute declaration.
  8767. Multi-value, optional.
  8768. Applies to <code class="option">xmlpipe2</code> source type only.
  8769. Syntax fully matches that of <a class="link" href="#conf-sql-attr-timestamp" title="12.1.20.&nbsp;sql_attr_timestamp">sql_attr_timestamp</a>.
  8770. </p><h4><a name="idp33263920"></a>Example:</h4><pre class="programlisting">
  8771. xmlpipe_attr_timestamp = published
  8772. </pre></div>
  8773. <div class="sect2" title="12.1.38.&nbsp;xmlpipe_attr_float"><div class="titlepage"><div><div><h3 class="title"><a name="conf-xmlpipe-attr-float"></a>12.1.38.&nbsp;xmlpipe_attr_float</h3></div></div></div>
  8774. <p>
  8775. xmlpipe floating point attribute declaration.
  8776. Multi-value, optional.
  8777. Applies to <code class="option">xmlpipe2</code> source type only.
  8778. Syntax fully matches that of <a class="link" href="#conf-sql-attr-float" title="12.1.21.&nbsp;sql_attr_float">sql_attr_float</a>.
  8779. </p><h4><a name="idp33267952"></a>Example:</h4><pre class="programlisting">
  8780. xmlpipe_attr_float = lat_radians
  8781. xmlpipe_attr_float = long_radians
  8782. </pre></div>
  8783. <div class="sect2" title="12.1.39.&nbsp;xmlpipe_attr_multi"><div class="titlepage"><div><div><h3 class="title"><a name="conf-xmlpipe-attr-multi"></a>12.1.39.&nbsp;xmlpipe_attr_multi</h3></div></div></div>
  8784. <p>
  8785. xmlpipe MVA attribute declaration.
  8786. Multi-value, optional.
  8787. Applies to <code class="option">xmlpipe2</code> source type only.
  8788. </p><p>
  8789. This setting declares an MVA attribute tag in xmlpipe2 stream.
  8790. The contents of the specified tag will be parsed and a list of integers
  8791. that will constitute the MVA will be extracted, similar to how
  8792. <a class="link" href="#conf-sql-attr-multi" title="12.1.22.&nbsp;sql_attr_multi">sql_attr_multi</a> parses
  8793. SQL column contents when 'field' MVA source type is specified.
  8794. </p><h4><a name="idp33272592"></a>Example:</h4><pre class="programlisting">
  8795. xmlpipe_attr_multi = taglist
  8796. </pre></div>
  8797. <div class="sect2" title="12.1.40.&nbsp;xmlpipe_attr_multi_64"><div class="titlepage"><div><div><h3 class="title"><a name="conf-xmlpipe-attr-multi-64"></a>12.1.40.&nbsp;xmlpipe_attr_multi_64</h3></div></div></div>
  8798. <p>
  8799. xmlpipe MVA attribute declaration. Declares the BIGINT (signed 64-bit integer) MVA attribute.
  8800. Multi-value, optional.
  8801. Applies to <code class="option">xmlpipe2</code> source type only.
  8802. </p><p>
  8803. This setting declares an MVA attribute tag in xmlpipe2 stream.
  8804. The contents of the specified tag will be parsed and a list of integers
  8805. that will constitute the MVA will be extracted, similar to how
  8806. <a class="link" href="#conf-sql-attr-multi" title="12.1.22.&nbsp;sql_attr_multi">sql_attr_multi</a> parses
  8807. SQL column contents when 'field' MVA source type is specified.
  8808. </p><h4><a name="idp33277280"></a>Example:</h4><pre class="programlisting">
  8809. xmlpipe_attr_multi_64 = taglist
  8810. </pre></div>
  8811. <div class="sect2" title="12.1.41.&nbsp;xmlpipe_attr_string"><div class="titlepage"><div><div><h3 class="title"><a name="conf-xmlpipe-attr-string"></a>12.1.41.&nbsp;xmlpipe_attr_string</h3></div></div></div>
  8812. <p>
  8813. xmlpipe string declaration.
  8814. Multi-value, optional.
  8815. Applies to <code class="option">xmlpipe2</code> source type only.
  8816. Introduced in version 1.10-beta.
  8817. </p><p>
  8818. This setting declares a string attribute tag in xmlpipe2 stream.
  8819. The contents of the specified tag will be parsed and stored as a string value.
  8820. </p><h4><a name="idp33281008"></a>Example:</h4><pre class="programlisting">
  8821. xmlpipe_attr_string = subject
  8822. </pre></div>
  8823. <div class="sect2" title="12.1.42.&nbsp;xmlpipe_attr_json"><div class="titlepage"><div><div><h3 class="title"><a name="conf-xmlpipe-attr-json"></a>12.1.42.&nbsp;xmlpipe_attr_json</h3></div></div></div>
  8824. <p>
  8825. JSON attribute declaration.
  8826. Multi-value (ie. there may be more than one such attribute declared), optional.
  8827. Introduced in version 2.1.1-beta.
  8828. </p><p>
  8829. This directive is used to declare that the contents of a given
  8830. XML tag are to be treated as a JSON document and stored into a Sphinx
  8831. index for later use. Refer to <a class="xref" href="#conf-sql-attr-json" title="12.1.24.&nbsp;sql_attr_json">Section&nbsp;12.1.24, &#8220;sql_attr_json&#8221;</a>
  8832. for more details on the JSON attributes.
  8833. </p><h4><a name="idp33285072"></a>Example:</h4><pre class="programlisting">
  8834. xmlpipe_attr_json = properties
  8835. </pre></div>
  8836. <div class="sect2" title="12.1.43.&nbsp;xmlpipe_fixup_utf8"><div class="titlepage"><div><div><h3 class="title"><a name="conf-xmlpipe-fixup-utf8"></a>12.1.43.&nbsp;xmlpipe_fixup_utf8</h3></div></div></div>
  8837. <p>
  8838. Perform Sphinx-side UTF-8 validation and filtering to prevent XML parser from choking on non-UTF-8 documents.
  8839. Optional, default is 0.
  8840. Applies to <code class="option">xmlpipe2</code> source type only.
  8841. </p><p>
  8842. Under certain occasions it might be hard or even impossible to guarantee
  8843. that the incoming XMLpipe2 document bodies are in perfectly valid and
  8844. conforming UTF-8 encoding. For instance, documents with national
  8845. single-byte encodings could sneak into the stream. libexpat XML parser
  8846. is fragile, meaning that it will stop processing in such cases.
  8847. UTF8 fixup feature lets you avoid that. When fixup is enabled,
  8848. Sphinx will preprocess the incoming stream before passing it to the
  8849. XML parser and replace invalid UTF-8 sequences with spaces.
  8850. </p><h4><a name="idp33289200"></a>Example:</h4><pre class="programlisting">
  8851. xmlpipe_fixup_utf8 = 1
  8852. </pre></div>
  8853. <div class="sect2" title="12.1.44.&nbsp;mssql_winauth"><div class="titlepage"><div><div><h3 class="title"><a name="conf-mssql-winauth"></a>12.1.44.&nbsp;mssql_winauth</h3></div></div></div>
  8854. <p>
  8855. MS SQL Windows authentication flag.
  8856. Boolean, optional, default value is 0 (false).
  8857. Applies to <code class="option">mssql</code> source type only.
  8858. Introduced in version 0.9.9-rc1.
  8859. </p><p>
  8860. Whether to use currently logged in Windows account credentials for
  8861. authentication when connecting to MS SQL Server. Note that when running
  8862. <code class="filename">searchd</code> as a service, account user can differ
  8863. from the account you used to install the service.
  8864. </p><h4><a name="idp33293792"></a>Example:</h4><pre class="programlisting">
  8865. mssql_winauth = 1
  8866. </pre></div>
  8867. <div class="sect2" title="12.1.45.&nbsp;unpack_zlib"><div class="titlepage"><div><div><h3 class="title"><a name="conf-unpack-zlib"></a>12.1.45.&nbsp;unpack_zlib</h3></div></div></div>
  8868. <p>
  8869. Columns to unpack using zlib (aka deflate, aka gunzip).
  8870. Multi-value, optional, default value is empty list of columns.
  8871. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8872. Introduced in version 0.9.9-rc1.
  8873. </p><p>
  8874. Columns specified using this directive will be unpacked by <code class="filename">indexer</code>
  8875. using standard zlib algorithm (called deflate and also implemented by <code class="filename">gunzip</code>).
  8876. When indexing on a different box than the database, this lets you offload the database, and save on network traffic.
  8877. The feature is only available if zlib and zlib-devel were both available during build time.
  8878. </p><h4><a name="idp33300000"></a>Example:</h4><pre class="programlisting">
  8879. unpack_zlib = col1
  8880. unpack_zlib = col2
  8881. </pre></div>
  8882. <div class="sect2" title="12.1.46.&nbsp;unpack_mysqlcompress"><div class="titlepage"><div><div><h3 class="title"><a name="conf-unpack-mysqlcompress"></a>12.1.46.&nbsp;unpack_mysqlcompress</h3></div></div></div>
  8883. <p>
  8884. Columns to unpack using MySQL UNCOMPRESS() algorithm.
  8885. Multi-value, optional, default value is empty list of columns.
  8886. Applies to SQL source types (<code class="option">mysql</code>, <code class="option">pgsql</code>, <code class="option">mssql</code>) only.
  8887. Introduced in version 0.9.9-rc1.
  8888. </p><p>
  8889. Columns specified using this directive will be unpacked by <code class="filename">indexer</code>
  8890. using modified zlib algorithm used by MySQL COMPRESS() and UNCOMPRESS() functions.
  8891. When indexing on a different box than the database, this lets you offload the database, and save on network traffic.
  8892. The feature is only available if zlib and zlib-devel were both available during build time.
  8893. </p><h4><a name="idp33305664"></a>Example:</h4><pre class="programlisting">
  8894. unpack_mysqlcompress = body_compressed
  8895. unpack_mysqlcompress = description_compressed
  8896. </pre></div>
  8897. <div class="sect2" title="12.1.47.&nbsp;unpack_mysqlcompress_maxsize"><div class="titlepage"><div><div><h3 class="title"><a name="conf-unpack-mysqlcompress-maxsize"></a>12.1.47.&nbsp;unpack_mysqlcompress_maxsize</h3></div></div></div>
  8898. <p>
  8899. Buffer size for UNCOMPRESS()ed data.
  8900. Optional, default value is 16M.
  8901. Introduced in version 0.9.9-rc1.
  8902. </p><p>
  8903. When using <a class="link" href="#conf-unpack-mysqlcompress" title="12.1.46.&nbsp;unpack_mysqlcompress">unpack_mysqlcompress</a>,
  8904. due to implementation intricacies it is not possible to deduce the required buffer size
  8905. from the compressed data. So the buffer must be preallocated in advance, and unpacked
  8906. data can not go over the buffer size. This option lets you control the buffer size,
  8907. both to limit <code class="filename">indexer</code> memory use, and to enable unpacking
  8908. of really long data fields if necessary.
  8909. </p><h4><a name="idp33310864"></a>Example:</h4><pre class="programlisting">
  8910. unpack_mysqlcompress_maxsize = 1M
  8911. </pre></div></div>
  8912. <div class="sect1" title="12.2.&nbsp;Index configuration options"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="confgroup-index"></a>12.2.&nbsp;Index configuration options</h2></div></div></div>
  8913. <div class="sect2" title="12.2.1.&nbsp;type"><div class="titlepage"><div><div><h3 class="title"><a name="conf-index-type"></a>12.2.1.&nbsp;type</h3></div></div></div>
  8914. <p>
  8915. Index type.
  8916. Known values are 'plain', 'distributed', 'rt' and 'template'.
  8917. Optional, default is 'plain' (plain local index).
  8918. </p><p>
  8919. Sphinx supports several different types of indexes.
  8920. Versions 0.9.x supported two index types: plain local indexes
  8921. that are stored and processed on the local machine; and distributed indexes,
  8922. that involve not only local searching but querying remote <code class="filename">searchd</code>
  8923. instances over the network as well (see <a class="xref" href="#distributed" title="5.8.&nbsp;Distributed searching">Section&nbsp;5.8, &#8220;Distributed searching&#8221;</a>).
  8924. Version 1.10-beta also adds support
  8925. for so-called real-time indexes (or RT indexes for short) that
  8926. are also stored and processed locally, but additionally allow
  8927. for on-the-fly updates of the full-text index (see <a class="xref" href="#rt-indexes" title="Chapter&nbsp;4.&nbsp;Real-time indexes">Chapter&nbsp;4, <i>Real-time indexes</i></a>).
  8928. Note that <span class="emphasis"><em>attributes</em></span> can be updated on-the-fly using
  8929. either plain local indexes or RT ones.
  8930. In 2.2.1-beta template indexes was introduced. They are actually a
  8931. pseudo-indexes because they do not store any data. That means they do not create
  8932. any files on your hard drive. But you can use them for keywords and snippets
  8933. generation, which may be useful in some cases.
  8934. </p><p>
  8935. Index type setting lets you choose the needed type.
  8936. By default, plain local index type will be assumed.
  8937. </p><h4><a name="idp33319024"></a>Example:</h4><pre class="programlisting">
  8938. type = distributed
  8939. </pre></div>
  8940. <div class="sect2" title="12.2.2.&nbsp;source"><div class="titlepage"><div><div><h3 class="title"><a name="conf-source"></a>12.2.2.&nbsp;source</h3></div></div></div>
  8941. <p>
  8942. Adds document source to local index.
  8943. Multi-value, mandatory.
  8944. </p><p>
  8945. Specifies document source to get documents from when the current
  8946. index is indexed. There must be at least one source. There may be multiple
  8947. sources, without any restrictions on the source types: ie. you can pull
  8948. part of the data from MySQL server, part from PostgreSQL, part from
  8949. the filesystem using xmlpipe2 wrapper.
  8950. </p><p>
  8951. However, there are some restrictions on the source data. First,
  8952. document IDs must be globally unique across all sources. If that
  8953. condition is not met, you might get unexpected search results.
  8954. Second, source schemas must be the same in order to be stored
  8955. within the same index.
  8956. </p><p>
  8957. No source ID is stored automatically. Therefore, in order to be able
  8958. to tell what source the matched document came from, you will need to
  8959. store some additional information yourself. Two typical approaches
  8960. include:
  8961. </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>mangling document ID and encoding source ID in it:
  8962. </p><pre class="programlisting">
  8963. source src1
  8964. {
  8965. sql_query = SELECT id*10+1, ... FROM table1
  8966. ...
  8967. }
  8968. source src2
  8969. {
  8970. sql_query = SELECT id*10+2, ... FROM table2
  8971. ...
  8972. }
  8973. </pre><p>
  8974. </p></li>
  8975. <li class="listitem"><p>
  8976. storing source ID simply as an attribute:
  8977. </p><pre class="programlisting">
  8978. source src1
  8979. {
  8980. sql_query = SELECT id, 1 AS source_id FROM table1
  8981. sql_attr_uint = source_id
  8982. ...
  8983. }
  8984. source src2
  8985. {
  8986. sql_query = SELECT id, 2 AS source_id FROM table2
  8987. sql_attr_uint = source_id
  8988. ...
  8989. }
  8990. </pre><p>
  8991. </p></li>
  8992. </ol></div>
  8993. <p>
  8994. </p><h4><a name="idp33327488"></a>Example:</h4><pre class="programlisting">
  8995. source = srcpart1
  8996. source = srcpart2
  8997. source = srcpart3
  8998. </pre></div>
  8999. <div class="sect2" title="12.2.3.&nbsp;path"><div class="titlepage"><div><div><h3 class="title"><a name="conf-path"></a>12.2.3.&nbsp;path</h3></div></div></div>
  9000. <p>
  9001. Index files path and file name (without extension).
  9002. Mandatory.
  9003. </p><p>
  9004. Path specifies both directory and file name, but without extension.
  9005. <code class="filename">indexer</code> will append different extensions
  9006. to this path when generating final names for both permanent and
  9007. temporary index files. Permanent data files have several different
  9008. extensions starting with '.sp'; temporary files' extensions
  9009. start with '.tmp'. It's safe to remove <code class="filename">.tmp*</code>
  9010. files is if indexer fails to remove them automatically.
  9011. </p><p>
  9012. For reference, different index files store the following data:
  9013. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="filename">.spa</code> stores document attributes (used in <a class="link" href="#conf-docinfo" title="12.2.4.&nbsp;docinfo">extern docinfo</a> storage mode only);</p></li>
  9014. <li class="listitem"><p><code class="filename">.spd</code> stores matching document ID lists for each word ID;</p></li>
  9015. <li class="listitem"><p><code class="filename">.sph</code> stores index header information;</p></li>
  9016. <li class="listitem"><p><code class="filename">.spi</code> stores word lists (word IDs and pointers to <code class="filename">.spd</code> file);</p></li>
  9017. <li class="listitem"><p><code class="filename">.spk</code> stores kill-lists;</p></li>
  9018. <li class="listitem"><p><code class="filename">.spm</code> stores MVA data;</p></li>
  9019. <li class="listitem"><p><code class="filename">.spp</code> stores hit (aka posting, aka word occurrence) lists for each word ID;</p></li>
  9020. <li class="listitem"><p><code class="filename">.sps</code> stores string attribute data.</p></li>
  9021. </ul></div>
  9022. <p>
  9023. </p><h4><a name="idp33343840"></a>Example:</h4><pre class="programlisting">
  9024. path = /var/data/test1
  9025. </pre></div>
  9026. <div class="sect2" title="12.2.4.&nbsp;docinfo"><div class="titlepage"><div><div><h3 class="title"><a name="conf-docinfo"></a>12.2.4.&nbsp;docinfo</h3></div></div></div>
  9027. <p>
  9028. Document attribute values (docinfo) storage mode.
  9029. Optional, default is 'extern'.
  9030. Known values are 'none', 'extern' and 'inline'.
  9031. </p><p>
  9032. Docinfo storage mode defines how exactly docinfo will be
  9033. physically stored on disk and RAM. "none" means that there will be
  9034. no docinfo at all (ie. no attributes). Normally you need not to set
  9035. "none" explicitly because Sphinx will automatically select "none"
  9036. when there are no attributes configured. "inline" means that the
  9037. docinfo will be stored in the <code class="filename">.spd</code> file,
  9038. along with the document ID lists. "extern" means that the docinfo
  9039. will be stored separately (externally) from document ID lists,
  9040. in a special <code class="filename">.spa</code> file.
  9041. </p><p>
  9042. Basically, externally stored docinfo must be kept in RAM when querying.
  9043. for performance reasons. So in some cases "inline" might be the only option.
  9044. However, such cases are infrequent, and docinfo defaults to "extern".
  9045. Refer to <a class="xref" href="#attributes" title="3.3.&nbsp;Attributes">Section&nbsp;3.3, &#8220;Attributes&#8221;</a> for in-depth discussion
  9046. and RAM usage estimates.
  9047. </p><h4><a name="idp33350272"></a>Example:</h4><pre class="programlisting">
  9048. docinfo = inline
  9049. </pre></div>
  9050. <div class="sect2" title="12.2.5.&nbsp;mlock"><div class="titlepage"><div><div><h3 class="title"><a name="conf-mlock"></a>12.2.5.&nbsp;mlock</h3></div></div></div>
  9051. <p>
  9052. Memory locking for cached data.
  9053. Optional, default is 0 (do not call mlock()).
  9054. </p><p>
  9055. For search performance, <code class="filename">searchd</code> preloads
  9056. a copy of <code class="filename">.spa</code> and <code class="filename">.spi</code>
  9057. files in RAM, and keeps that copy in RAM at all times. But if there
  9058. are no searches on the index for some time, there are no accesses
  9059. to that cached copy, and OS might decide to swap it out to disk.
  9060. First queries to such "cooled down" index will cause swap-in
  9061. and their latency will suffer.
  9062. </p><p>
  9063. Setting mlock option to 1 makes Sphinx lock physical RAM used
  9064. for that cached data using mlock(2) system call, and that prevents
  9065. swapping (see man 2 mlock for details). mlock(2) is a privileged call,
  9066. so it will require <code class="filename">searchd</code> to be either run
  9067. from root account, or be granted enough privileges otherwise.
  9068. If mlock() fails, a warning is emitted, but index continues
  9069. working.
  9070. </p><h4><a name="idp33357264"></a>Example:</h4><pre class="programlisting">
  9071. mlock = 1
  9072. </pre></div>
  9073. <div class="sect2" title="12.2.6.&nbsp;morphology"><div class="titlepage"><div><div><h3 class="title"><a name="conf-morphology"></a>12.2.6.&nbsp;morphology</h3></div></div></div>
  9074. <p>
  9075. A list of morphology preprocessors (stemmers or lemmatizers) to apply.
  9076. Optional, default is empty (do not apply any preprocessor).
  9077. </p><p>
  9078. Morphology preprocessors can be applied to the words being
  9079. indexed to replace different forms of the same word with the base,
  9080. normalized form. For instance, English stemmer will normalize
  9081. both "dogs" and "dog" to "dog", making search results for
  9082. both searches the same.
  9083. </p><p>
  9084. There are 3 different morphology preprocessors that Sphinx implements:
  9085. lemmatizers, stemmers, and phonetic algorithms.
  9086. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Lemmatizer reduces a keyword form to a so-called lemma,
  9087. a proper normal form, or in other words, a valid natural language
  9088. root word. For example, "running" could be reduced to "run",
  9089. the infinitive verb form, and "octopi" would be reduced to "octopus",
  9090. the singular noun form. Note that sometimes a word form can have
  9091. multiple corresponding root words. For instance, by looking at
  9092. "dove" it is not possible to tell whether this is a past tense
  9093. of "dive" the verb as in "He dove into a pool.", or "dove" the noun
  9094. as in "White dove flew over the cuckoo's nest." In this case
  9095. lemmatizer can generate all the possible root forms.
  9096. </p></li>
  9097. <li class="listitem"><p>Stemmer reduces a keyword form to a so-called stem
  9098. by removing and/or replacing certain well-known suffixes.
  9099. The resulting stem is however <span class="bold"><strong>not</strong></span>guaranteed to be
  9100. a valid word on itself. For instance, with a Porter English
  9101. stemmers "running" would still reduce to "run", which is fine,
  9102. but "business" would reduce to "busi", which is not a word,
  9103. and "octopi" would not reduce at all. Stemmers are essentially
  9104. (much) simpler but still pretty good replacements of full-blown
  9105. lemmatizers.
  9106. </p></li>
  9107. <li class="listitem"><p>Phonetic algorithms replace the words with specially
  9108. crafted phonetic codes that are equal even when the words original
  9109. are different, but phonetically close.
  9110. </p></li>
  9111. </ul></div>
  9112. <p>
  9113. The morphology processors that come with our own built-in Sphinx
  9114. implementations are:
  9115. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>English, Russian, and German lemmatizers;</p></li>
  9116. <li class="listitem"><p>English, Russian, Arabic, and Czech stemmers;</p></li>
  9117. <li class="listitem"><p>SoundEx and MetaPhone phonetic algorithms.</p></li>
  9118. </ul></div>
  9119. <p>
  9120. You can also link with <span class="bold"><strong>libstemmer</strong></span> library for even more
  9121. stemmers (see details below). With libstemmer, Sphinx also supports
  9122. morphological processing for more than 15 other languages. Binary
  9123. packages should come prebuilt with libstemmer support, too.
  9124. </p><p>
  9125. Lemmatizer support was added in version 2.1.1-beta, starting with
  9126. a Russian lemmatizer. English and German lemmatizers were then added
  9127. in version 2.2.1-beta.
  9128. </p><p>
  9129. Lemmatizers require a dictionary that needs to be
  9130. additionally downloaded from the Sphinx website. That dictionary
  9131. needs to be installed in a directory specified by
  9132. <a class="link" href="#conf-lemmatizer-base" title="12.5.1.&nbsp;lemmatizer_base">lemmatizer_base</a>
  9133. directive. Also, there is a
  9134. <a class="link" href="#conf-lemmatizer-cache" title="12.3.8.&nbsp;lemmatizer_cache">lemmatizer_cache</a>
  9135. directive that lets you speed up lemmatizing (and therefore
  9136. indexing) by spending more RAM for, basically, an uncompressed
  9137. cache of a dictionary.
  9138. </p><p>
  9139. Chinese segmentation using Rosette Linguistics Platform was added in 2.2.1-beta.
  9140. It is a much more precise but slower way (compared to n-grams) to segment Chinese documents.
  9141. <code class="option"><a class="link" href="#conf-charset-table" title="12.2.16.&nbsp;charset_table">charset_table</a></code> must contain all Chinese characters except
  9142. Chinese punctuation marks because incoming documents are first processed by sphinx tokenizer and then the result
  9143. is processed by RLP. Sphinx performs per-token language detection on the incoming documents. If token language is
  9144. identified as Chinese, it will only be processed the RLP, even if multiple morphology processors are specified.
  9145. Otherwise, it will be processed by all the morphology processors specified in the "morphology" option. Rosette
  9146. Linguistics Platform must be installed and configured and sphinx must be built with a --with-rlp switch. See also
  9147. <code class="option"><a class="link" href="#conf-rlp-root" title="12.5.5.&nbsp;rlp_root">rlp_root</a></code>,
  9148. <code class="option"><a class="link" href="#conf-rlp-environment" title="12.5.6.&nbsp;rlp_environment">rlp_environment</a></code> and
  9149. <code class="option"><a class="link" href="#conf-rlp-context" title="12.2.67.&nbsp;rlp_context">rlp_context</a></code> options.
  9150. A batched version of RLP segmentation is also available (<code class="option">rlp_chinese_batched</code>). It provides the
  9151. same functionality as the basic <code class="option">rlp_chinese</code> segmentation, but enables batching documents before
  9152. processing them by the RLP. Processing several documents at once can result in a substantial indexing speedup if
  9153. the documents are small (for example, less than 1k). See also
  9154. <code class="option"><a class="link" href="#conf-rlp-max-batch-size" title="12.5.7.&nbsp;rlp_max_batch_size">rlp_max_batch_size</a></code> and
  9155. <code class="option"><a class="link" href="#conf-rlp-max-batch-docs" title="12.5.8.&nbsp;rlp_max_batch_docs">rlp_max_batch_docs</a></code> options.
  9156. </p><p>
  9157. Additional stemmers provided by <a class="ulink" href="http://snowball.tartarus.org/" target="_top">Snowball</a>
  9158. project <a class="ulink" href="http://snowball.tartarus.org/dist/libstemmer_c.tgz" target="_top">libstemmer</a> library
  9159. can be enabled at compile time using <code class="option">--with-libstemmer</code> <code class="filename">configure</code> option.
  9160. Built-in English and Russian stemmers should be faster than their
  9161. libstemmer counterparts, but can produce slightly different results,
  9162. because they are based on an older version.
  9163. </p><p>
  9164. Soundex implementation matches that of MySQL. Metaphone implementation
  9165. is based on Double Metaphone algorithm and indexes the primary code.
  9166. </p><p>
  9167. Built-in values that are available for use in <code class="option">morphology</code>
  9168. option are as follows:
  9169. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>none - do not perform any morphology processing;</p></li>
  9170. <li class="listitem"><p>lemmatize_ru - apply Russian lemmatizer and pick a single root form (added in 2.1.1-beta);</p></li>
  9171. <li class="listitem"><p>lemmatize_en - apply English lemmatizer and pick a single root form (added in 2.2.1-beta);</p></li>
  9172. <li class="listitem"><p>lemmatize_de - apply German lemmatizer and pick a single root form (added in 2.2.1-beta);</p></li>
  9173. <li class="listitem"><p>lemmatize_ru_all - apply Russian lemmatizer and index all possible root forms (added in 2.1.1-beta);</p></li>
  9174. <li class="listitem"><p>lemmatize_en_all - apply Russian lemmatizer and index all possible root forms (added in 2.2.1-beta);</p></li>
  9175. <li class="listitem"><p>lemmatize_de_all - apply Russian lemmatizer and index all possible root forms (added in 2.2.1-beta);</p></li>
  9176. <li class="listitem"><p>stem_en - apply Porter's English stemmer;</p></li>
  9177. <li class="listitem"><p>stem_ru - apply Porter's Russian stemmer;</p></li>
  9178. <li class="listitem"><p>stem_enru - apply Porter's English and Russian stemmers;</p></li>
  9179. <li class="listitem"><p>stem_cz - apply Czech stemmer;</p></li>
  9180. <li class="listitem"><p>stem_ar - apply Arabic stemmer (added in 2.1.1-beta);</p></li>
  9181. <li class="listitem"><p>soundex - replace keywords with their SOUNDEX code;</p></li>
  9182. <li class="listitem"><p>metaphone - replace keywords with their METAPHONE code.</p></li>
  9183. <li class="listitem"><p>rlp_chinese - apply Chinese text segmentation using Rosette Linguistics Platform</p></li>
  9184. <li class="listitem"><p>rlp_chinese_batched - apply Chinese text segmentation using Rosette Linguistics Platform with document batching</p></li>
  9185. </ul></div>
  9186. <p>
  9187. Additional values provided by libstemmer are in 'libstemmer_XXX' format,
  9188. where XXX is libstemmer algorithm codename (refer to
  9189. <code class="filename">libstemmer_c/libstemmer/modules.txt</code> for a complete list).
  9190. </p><p>
  9191. Several stemmers can be specified (comma-separated). They will be applied
  9192. to incoming words in the order they are listed, and the processing will stop
  9193. once one of the stemmers actually modifies the word.
  9194. Also when <a class="link" href="#conf-wordforms" title="12.2.12.&nbsp;wordforms">wordforms</a> feature is enabled
  9195. the word will be looked up in word forms dictionary first, and if there is
  9196. a matching entry in the dictionary, stemmers will not be applied at all.
  9197. Or in other words, <a class="link" href="#conf-wordforms" title="12.2.12.&nbsp;wordforms">wordforms</a> can be
  9198. used to implement stemming exceptions.
  9199. </p><h4><a name="idp33398320"></a>Example:</h4><pre class="programlisting">
  9200. morphology = stem_en, libstemmer_sv
  9201. </pre></div>
  9202. <div class="sect2" title="12.2.7.&nbsp;dict"><div class="titlepage"><div><div><h3 class="title"><a name="conf-dict"></a>12.2.7.&nbsp;dict</h3></div></div></div>
  9203. <p>
  9204. The keywords dictionary type.
  9205. Known values are 'crc' and 'keywords'.
  9206. 'crc' is DEPRECATED. Use 'keywords' instead.
  9207. Optional, default is 'keywords'.
  9208. Introduced in version 2.0.1-beta.
  9209. </p><p>
  9210. CRC dictionary mode (dict=crc) is the default dictionary type
  9211. in Sphinx, and the only one available until version 2.0.1-beta.
  9212. Keywords dictionary mode (dict=keywords) was added in 2.0.1-beta,
  9213. primarily to (greatly) reduce indexing impact and enable substring
  9214. searches on huge collections. They also eliminate the chance of
  9215. CRC32 collisions. In 2.0.1-beta, that mode was only supported
  9216. for disk indexes. Starting with 2.0.2-beta, RT indexes are
  9217. also supported.
  9218. </p><p>
  9219. CRC dictionaries never store the original keyword text in the index.
  9220. Instead, keywords are replaced with their control sum value (either CRC32 or
  9221. FNV64, depending whether Sphinx was built with <code class="option">--enable-id64</code>)
  9222. both when searching and indexing, and that value is used internally
  9223. in the index.
  9224. </p><p>
  9225. That approach has two drawbacks. First, in CRC32 case there is
  9226. a chance of control sum collision between several pairs of different
  9227. keywords, growing quadratically with the number of unique keywords
  9228. in the index. (FNV64 case is unaffected in practice, as a chance
  9229. of a single FNV64 collision in a dictionary of 1 billion entries
  9230. is approximately 1:16, or 6.25 percent. And most dictionaries
  9231. will be much more compact that a billion keywords, as a typical
  9232. spoken human language has in the region of 1 to 10 million word
  9233. forms.) Second, and more importantly, substring searches are not
  9234. directly possible with control sums. Sphinx alleviated that by
  9235. pre-indexing all the possible substrings as separate keywords
  9236. (see <a class="xref" href="#conf-min-prefix-len" title="12.2.18.&nbsp;min_prefix_len">Section&nbsp;12.2.18, &#8220;min_prefix_len&#8221;</a>, <a class="xref" href="#conf-min-infix-len" title="12.2.19.&nbsp;min_infix_len">Section&nbsp;12.2.19, &#8220;min_infix_len&#8221;</a>
  9237. directives). That actually has an added benefit of matching
  9238. substrings in the quickest way possible. But at the same time
  9239. pre-indexing all substrings grows the index size a lot (factors
  9240. of 3-10x and even more would not be unusual) and impacts the
  9241. indexing time respectively, rendering substring searches
  9242. on big indexes rather impractical.
  9243. </p><p>
  9244. Keywords dictionary, introduced in 2.0.1-beta, fixes both these
  9245. drawbacks. It stores the keywords in the index and performs
  9246. search-time wildcard expansion. For example, a search for a
  9247. 'test*' prefix could internally expand to 'test|tests|testing'
  9248. query based on the dictionary contents. That expansion is fully
  9249. transparent to the application, except that the separate
  9250. per-keyword statistics for all the actually matched keywords
  9251. would now also be reported.
  9252. </p><p>
  9253. Version 2.1.1-beta introduced extended wildcards support, now special
  9254. symbols like '?' and '%' are supported along with substring (infix) search (e.g. "t?st*", "run%", "*abc*").
  9255. Note, however, these wildcards work only with dict=keywords, and not elsewhere.
  9256. </p><p>
  9257. Indexing with keywords dictionary should be 1.1x to 1.3x slower
  9258. compared to regular, non-substring indexing - but times faster
  9259. compared to substring indexing (either prefix or infix). Index size
  9260. should only be slightly bigger that than of the regular non-substring
  9261. index, with a 1..10% percent total difference.
  9262. Regular keyword searching time must be very close or identical across
  9263. all three discussed index kinds (CRC non-substring, CRC substring,
  9264. keywords). Substring searching time can vary greatly depending
  9265. on how many actual keywords match the given substring (in other
  9266. words, into how many keywords does the search term expand).
  9267. The maximum number of keywords matched is restricted by the
  9268. <a class="link" href="#conf-expansion-limit" title="12.4.35.&nbsp;expansion_limit">expansion_limit</a>
  9269. directive.
  9270. </p><p>
  9271. Essentially, keywords and CRC dictionaries represent the two
  9272. different trade-off substring searching decisions. You can choose
  9273. to either sacrifice indexing time and index size in favor of
  9274. top-speed worst-case searches (CRC dictionary), or only slightly
  9275. impact indexing time but sacrifice worst-case searching time when
  9276. the prefix expands into very many keywords (keywords dictionary).
  9277. </p><h4><a name="idp33411072"></a>Example:</h4><pre class="programlisting">
  9278. dict = keywords
  9279. </pre></div>
  9280. <div class="sect2" title="12.2.8.&nbsp;index_sp"><div class="titlepage"><div><div><h3 class="title"><a name="conf-index-sp"></a>12.2.8.&nbsp;index_sp</h3></div></div></div>
  9281. <p>
  9282. Whether to detect and index sentence and paragraph boundaries.
  9283. Optional, default is 0 (do not detect and index).
  9284. Introduced in version 2.0.1-beta.
  9285. </p><p>
  9286. This directive enables sentence and paragraph boundary indexing.
  9287. It's required for the SENTENCE and PARAGRAPH operators to work.
  9288. Sentence boundary detection is based on plain text analysis, so you
  9289. only need to set <code class="code">index_sp = 1</code> to enable it. Paragraph
  9290. detection is however based on HTML markup, and happens in the
  9291. <a class="link" href="#conf-html-strip" title="12.2.27.&nbsp;html_strip">HTML stripper</a>.
  9292. So to index paragraph locations you also need to enable the stripper
  9293. by specifying <code class="code">html_strip = 1</code>. Both types of boundaries
  9294. are detected based on a few built-in rules enumerated just below.
  9295. </p><p>
  9296. Sentence boundary detection rules are as follows.
  9297. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Question and exclamation signs (? and !) are always a sentence boundary.</p></li>
  9298. <li class="listitem"><p>Trailing dot (.) is a sentence boundary, except:
  9299. </p><div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>When followed by a letter. That's considered a part of an abbreviation (as in "S.T.A.L.K.E.R" or "Goldman Sachs S.p.A.").</p></li>
  9300. <li class="listitem"><p>When followed by a comma. That's considered an abbreviation followed by a comma (as in "Telecom Italia S.p.A., founded in 1994").</p></li>
  9301. <li class="listitem"><p>When followed by a space and a small letter. That's considered an abbreviation within a sentence (as in "News Corp. announced in February").</p></li>
  9302. <li class="listitem"><p>When preceded by a space and a capital letter, and followed by a space. That's considered a middle initial (as in "John D. Doe").</p></li>
  9303. </ul></div>
  9304. <p>
  9305. </p></li>
  9306. </ul></div>
  9307. <p>
  9308. </p><p>
  9309. Paragraph boundaries are inserted at every block-level HTML tag.
  9310. Namely, those are (as taken from HTML 4 standard) ADDRESS, BLOCKQUOTE,
  9311. CAPTION, CENTER, DD, DIV, DL, DT, H1, H2, H3, H4, H5, LI, MENU, OL, P,
  9312. PRE, TABLE, TBODY, TD, TFOOT, TH, THEAD, TR, and UL.
  9313. </p><p>
  9314. Both sentences and paragraphs increment the keyword position counter by 1.
  9315. </p><h4><a name="idp33422656"></a>Example:</h4><pre class="programlisting">
  9316. index_sp = 1
  9317. </pre></div>
  9318. <div class="sect2" title="12.2.9.&nbsp;index_zones"><div class="titlepage"><div><div><h3 class="title"><a name="conf-index-zones"></a>12.2.9.&nbsp;index_zones</h3></div></div></div>
  9319. <p>
  9320. A list of in-field HTML/XML zones to index.
  9321. Optional, default is empty (do not index zones).
  9322. Introduced in version 2.0.1-beta.
  9323. </p><p>
  9324. Zones can be formally defined as follows. Everything between
  9325. an opening and a matching closing tag is called a span, and
  9326. the aggregate of all spans corresponding sharing the same
  9327. tag name is called a zone. For instance, everything between
  9328. the occurrences of &lt;H1&gt; and &lt;/H1&gt; in the document
  9329. field belongs to H1 zone.
  9330. </p><p>
  9331. Zone indexing, enabled by <code class="code">index_zones</code> directive,
  9332. is an optional extension of the HTML stripper. So it will also
  9333. require that the <a class="link" href="#conf-html-strip" title="12.2.27.&nbsp;html_strip">stripper</a>
  9334. is enabled (with <code class="code">html_strip = 1</code>). The value of the
  9335. <code class="code">index_zones</code> should be a comma-separated list of
  9336. those tag names and wildcards (ending with a star) that should
  9337. be indexed as zones.
  9338. </p><p>
  9339. Zones can nest and overlap arbitrarily. The only requirement
  9340. is that every opening tag has a matching tag. You can also have
  9341. an arbitrary number of both zones (as in unique zone names,
  9342. such as H1) and spans (all the occurrences of those H1 tags)
  9343. in a document.
  9344. Once indexed, zones can then be used for matching with
  9345. the ZONE operator, see <a class="xref" href="#extended-syntax" title="5.3.&nbsp;Extended query syntax">Section&nbsp;5.3, &#8220;Extended query syntax&#8221;</a>.
  9346. </p><h4><a name="idp33430464"></a>Example:</h4><pre class="programlisting">
  9347. index_zones = h*, th, title
  9348. </pre><p>
  9349. Earlier versions than 2.1.1-beta only provided this feature for plain
  9350. index files; currently, RT index files also provide it.
  9351. </p></div>
  9352. <div class="sect2" title="12.2.10.&nbsp;min_stemming_len"><div class="titlepage"><div><div><h3 class="title"><a name="conf-min-stemming-len"></a>12.2.10.&nbsp;min_stemming_len</h3></div></div></div>
  9353. <p>
  9354. Minimum word length at which to enable stemming.
  9355. Optional, default is 1 (stem everything).
  9356. Introduced in version 0.9.9-rc1.
  9357. </p><p>
  9358. Stemmers are not perfect, and might sometimes produce undesired results.
  9359. For instance, running "gps" keyword through Porter stemmer for English
  9360. results in "gp", which is not really the intent. <code class="option">min_stemming_len</code>
  9361. feature lets you suppress stemming based on the source word length,
  9362. ie. to avoid stemming too short words. Keywords that are shorter than
  9363. the given threshold will not be stemmed. Note that keywords that are
  9364. exactly as long as specified <span class="bold"><strong>will</strong></span> be stemmed. So in order to avoid
  9365. stemming 3-character keywords, you should specify 4 for the value.
  9366. For more finely grained control, refer to <a class="link" href="#conf-wordforms" title="12.2.12.&nbsp;wordforms">wordforms</a> feature.
  9367. </p><h4><a name="idp33436640"></a>Example:</h4><pre class="programlisting">
  9368. min_stemming_len = 4
  9369. </pre></div>
  9370. <div class="sect2" title="12.2.11.&nbsp;stopwords"><div class="titlepage"><div><div><h3 class="title"><a name="conf-stopwords"></a>12.2.11.&nbsp;stopwords</h3></div></div></div>
  9371. <p>
  9372. Stopword files list (space separated).
  9373. Optional, default is empty.
  9374. </p><p>
  9375. Stopwords are the words that will not be indexed. Typically you'd
  9376. put most frequent words in the stopwords list because they do not add
  9377. much value to search results but consume a lot of resources to process.
  9378. </p><p>
  9379. You can specify several file names, separated by spaces. All the files
  9380. will be loaded. Stopwords file format is simple plain text. The encoding
  9381. must be UTF-8.
  9382. File data will be tokenized with respect to <a class="link" href="#conf-charset-table" title="12.2.16.&nbsp;charset_table">charset_table</a>
  9383. settings, so you can use the same separators as in the indexed data.
  9384. </p><p>
  9385. The <a class="link" href="#conf-morphology" title="12.2.6.&nbsp;morphology">stemmers</a> will normally be
  9386. applied when parsing stopwords file. That might however lead to undesired
  9387. results. Starting with 2.1.1-beta, you can turn that off with
  9388. <a class="link" href="#conf-stopwords-unstemmed" title="12.2.65.&nbsp;stopwords_unstemmed">stopwords_unstemmed</a>.
  9389. </p><p>
  9390. Starting with version 2.1.1-beta small enough files are stored in the index
  9391. header, see <a class="xref" href="#conf-embedded-limit" title="12.2.13.&nbsp;embedded_limit">Section&nbsp;12.2.13, &#8220;embedded_limit&#8221;</a> for details.
  9392. </p><p>
  9393. While stopwords are not indexed, they still do affect the keyword positions.
  9394. For instance, assume that "the" is a stopword, that document 1 contains the line
  9395. "in office", and that document 2 contains "in the office". Searching for "in office"
  9396. as for exact phrase will only return the first document, as expected, even though
  9397. "the" in the second one is stopped. That behavior can be tweaked through the
  9398. <a class="link" href="#conf-stopword-step" title="12.2.44.&nbsp;stopword_step">stopword_step</a> directive.
  9399. </p><p>
  9400. Stopwords files can either be created manually, or semi-automatically.
  9401. <code class="filename">indexer</code> provides a mode that creates a frequency dictionary
  9402. of the index, sorted by the keyword frequency, see <code class="option">--buildstops</code>
  9403. and <code class="option">--buildfreqs</code> switch in <a class="xref" href="#ref-indexer" title="7.1.&nbsp;indexer command reference">Section&nbsp;7.1, &#8220;<code class="filename">indexer</code> command reference&#8221;</a>.
  9404. Top keywords from that dictionary can usually be used as stopwords.
  9405. </p><h4><a name="idp33449904"></a>Example:</h4><pre class="programlisting">
  9406. stopwords = /usr/local/sphinx/data/stopwords.txt
  9407. stopwords = stopwords-ru.txt stopwords-en.txt
  9408. </pre></div>
  9409. <div class="sect2" title="12.2.12.&nbsp;wordforms"><div class="titlepage"><div><div><h3 class="title"><a name="conf-wordforms"></a>12.2.12.&nbsp;wordforms</h3></div></div></div>
  9410. <p>
  9411. Word forms dictionary.
  9412. Optional, default is empty.
  9413. </p><p>
  9414. Word forms are applied after tokenizing the incoming text
  9415. by <a class="link" href="#conf-charset-table" title="12.2.16.&nbsp;charset_table">charset_table</a> rules.
  9416. They essentially let you replace one word with another. Normally,
  9417. that would be used to bring different word forms to a single
  9418. normal form (eg. to normalize all the variants such as "walks",
  9419. "walked", "walking" to the normal form "walk"). It can also be used
  9420. to implement stemming exceptions, because stemming is not applied
  9421. to words found in the forms list.
  9422. </p><p>
  9423. Starting with version 2.1.1-beta small enough files are stored in the index
  9424. header, see <a class="xref" href="#conf-embedded-limit" title="12.2.13.&nbsp;embedded_limit">Section&nbsp;12.2.13, &#8220;embedded_limit&#8221;</a> for details.
  9425. </p><p>
  9426. Dictionaries are used to normalize incoming words both during indexing
  9427. and searching. Therefore, to pick up changes in wordforms file
  9428. it's required to rotate index.
  9429. </p><p>
  9430. Word forms support in Sphinx is designed to support big dictionaries well.
  9431. They moderately affect indexing speed: for instance, a dictionary with 1 million
  9432. entries slows down indexing about 1.5 times. Searching speed is not affected at all.
  9433. Additional RAM impact is roughly equal to the dictionary file size,
  9434. and dictionaries are shared across indexes: ie. if the very same 50 MB wordforms
  9435. file is specified for 10 different indexes, additional <code class="filename">searchd</code>
  9436. RAM usage will be about 50 MB.
  9437. </p><p>
  9438. Dictionary file should be in a simple plain text format. Each line
  9439. should contain source and destination word forms, in UTF-8 encoding,
  9440. separated by "greater" sign. Rules from the
  9441. <a class="link" href="#conf-charset-table" title="12.2.16.&nbsp;charset_table">charset_table</a> will be
  9442. applied when the file is loaded. So basically it's as case sensitive
  9443. as your other full-text indexed data, ie. typically case insensitive.
  9444. Here's the file contents sample:
  9445. </p><pre class="programlisting">
  9446. walks &gt; walk
  9447. walked &gt; walk
  9448. walking &gt; walk
  9449. </pre><p>
  9450. </p><p>
  9451. There is a bundled <code class="filename">spelldump</code> utility that
  9452. helps you create a dictionary file in the format Sphinx can read
  9453. from source <code class="filename">.dict</code> and <code class="filename">.aff</code>
  9454. dictionary files in <code class="filename">ispell</code> or <code class="filename">MySpell</code>
  9455. format (as bundled with OpenOffice).
  9456. </p><p>
  9457. Starting with version 0.9.9-rc1, you can map several source words
  9458. to a single destination word. Because the work happens on tokens,
  9459. not the source text, differences in whitespace and markup are ignored.
  9460. </p><p>
  9461. Starting with version 2.1.1-beta, you can use "=&gt;" instead of "&gt;". Comments
  9462. (starting with "#" are also allowed. Finally, if a line starts with a tilde ("~")
  9463. the wordform will be applied after morphology, instead of before.
  9464. </p><pre class="programlisting">
  9465. core 2 duo &gt; c2d
  9466. e6600 &gt; c2d
  9467. core 2duo =&gt; c2d # Some people write '2duo' together...
  9468. </pre><p>
  9469. </p><p>
  9470. Stating with version 2.2.4, you can specify multiple destination tokens:
  9471. </p><pre class="programlisting">
  9472. s02e02 &gt; season 2 episode 2
  9473. s3 e3 &gt; season 3 episode 3
  9474. </pre><p>
  9475. </p><h4><a name="idp33467520"></a>Example:</h4><pre class="programlisting">
  9476. wordforms = /usr/local/sphinx/data/wordforms.txt
  9477. wordforms = /usr/local/sphinx/data/alternateforms.txt
  9478. wordforms = /usr/local/sphinx/private/dict*.txt
  9479. </pre><p>
  9480. Starting with version 2.1.1-beta you can specify several files and not
  9481. only just one. Masks can be used as a pattern, and all matching files will
  9482. be processed in simple ascending order. (If multi-byte codepages are used,
  9483. and file names can include foreign characters, the resulting order may not
  9484. be exactly alphabetic.) If a same wordform definition is found in several
  9485. files, the latter one is used, and it overrides previous definitions.
  9486. </p></div>
  9487. <div class="sect2" title="12.2.13.&nbsp;embedded_limit"><div class="titlepage"><div><div><h3 class="title"><a name="conf-embedded-limit"></a>12.2.13.&nbsp;embedded_limit</h3></div></div></div>
  9488. <p>
  9489. Embedded exceptions, wordforms, or stopwords file size limit.
  9490. Optional, default is 16K.
  9491. Added in version 2.1.1-beta.
  9492. </p><p>
  9493. Before 2.1.1-beta, the contents of exceptions, wordforms, or stopwords
  9494. files were always kept in the files. Only the file names were stored into
  9495. the index. Starting with 2.1.1-beta, indexer can either save the file name,
  9496. or embed the file contents directly into the index. Files sized under
  9497. <code class="code">embedded_limit</code> get stored into the index. For bigger files,
  9498. only the file names are stored. This also simplifies moving index files
  9499. to a different machine; you may get by just copying a single file.
  9500. </p><p>
  9501. With smaller files, such embedding reduces the number of the external
  9502. files on which the index depends, and helps maintenance. But at the same
  9503. time it makes no sense to embed a 100 MB wordforms dictionary into a tiny
  9504. delta index. So there needs to be a size threshold, and <code class="code">embedded_limit</code>
  9505. is that threshold.
  9506. </p><h4><a name="idp33473600"></a>Example:</h4><pre class="programlisting">
  9507. embedded_limit = 32K
  9508. </pre></div>
  9509. <div class="sect2" title="12.2.14.&nbsp;exceptions"><div class="titlepage"><div><div><h3 class="title"><a name="conf-exceptions"></a>12.2.14.&nbsp;exceptions</h3></div></div></div>
  9510. <p>
  9511. Tokenizing exceptions file.
  9512. Optional, default is empty.
  9513. </p><p>
  9514. Exceptions allow to map one or more tokens (including tokens with
  9515. characters that would normally be excluded) to a single keyword.
  9516. They are similar to <a class="link" href="#conf-wordforms" title="12.2.12.&nbsp;wordforms">wordforms</a>
  9517. in that they also perform mapping, but have a number of important
  9518. differences.
  9519. </p><p>
  9520. Starting with version 2.1.1-beta small enough files are stored in the index
  9521. header, see <a class="xref" href="#conf-embedded-limit" title="12.2.13.&nbsp;embedded_limit">Section&nbsp;12.2.13, &#8220;embedded_limit&#8221;</a> for details.
  9522. </p><p>
  9523. Short summary of the differences is as follows:
  9524. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>exceptions are case sensitive, wordforms are not;</p></li>
  9525. <li class="listitem"><p>exceptions can use special characters that are <span class="bold"><strong>not</strong></span> in charset_table, wordforms fully obey charset_table;</p></li>
  9526. <li class="listitem"><p>exceptions can underperform on huge dictionaries, wordforms handle millions of entries well.</p></li>
  9527. </ul></div>
  9528. <p>
  9529. </p><p>
  9530. The expected file format is also plain text, with one line per exception,
  9531. and the line format is as follows:
  9532. </p><pre class="programlisting">
  9533. map-from-tokens =&gt; map-to-token
  9534. </pre><p>
  9535. Example file:
  9536. </p><pre class="programlisting">
  9537. at &amp; t =&gt; at&amp;t
  9538. AT&amp;T =&gt; AT&amp;T
  9539. Standarten Fuehrer =&gt; standartenfuhrer
  9540. Standarten Fuhrer =&gt; standartenfuhrer
  9541. MS Windows =&gt; ms windows
  9542. Microsoft Windows =&gt; ms windows
  9543. C++ =&gt; cplusplus
  9544. c++ =&gt; cplusplus
  9545. C plus plus =&gt; cplusplus
  9546. </pre><p>
  9547. All tokens here are case sensitive: they will <span class="bold"><strong>not</strong></span> be processed by
  9548. <a class="link" href="#conf-charset-table" title="12.2.16.&nbsp;charset_table">charset_table</a> rules. Thus, with
  9549. the example exceptions file above, "at&amp;t" text will be tokenized as two
  9550. keywords "at" and "t", because of lowercase letters. On the other hand,
  9551. "AT&amp;T" will match exactly and produce single "AT&amp;T" keyword.
  9552. </p><p>
  9553. Note that this map-to keyword is a) always interpreted
  9554. as a <span class="emphasis"><em>single</em></span> word, and b) is both case and space
  9555. sensitive! In our sample, "ms windows" query will <span class="emphasis"><em>not</em></span>
  9556. match the document with "MS Windows" text. The query will be interpreted
  9557. as a query for two keywords, "ms" and "windows". And what "MS Windows"
  9558. gets mapped to is a <span class="emphasis"><em>single</em></span> keyword "ms windows",
  9559. with a space in the middle. On the other hand, "standartenfuhrer"
  9560. will retrieve documents with "Standarten Fuhrer" or "Standarten Fuehrer"
  9561. contents (capitalized exactly like this), or any capitalization variant
  9562. of the keyword itself, eg. "staNdarTenfUhreR". (It won't catch
  9563. "standarten fuhrer", however: this text does not match any of the
  9564. listed exceptions because of case sensitivity, and gets indexed
  9565. as two separate keywords.)
  9566. </p><p>
  9567. Whitespace in the map-from tokens list matters, but its amount does not.
  9568. Any amount of the whitespace in the map-form list will match any other amount
  9569. of whitespace in the indexed document or query. For instance, "AT&nbsp;&amp;&nbsp;T"
  9570. map-from token will match "AT&nbsp;&nbsp;&nbsp;&nbsp;&amp;&nbsp;&nbsp;T" text,
  9571. whatever the amount of space in both map-from part and the indexed text.
  9572. Such text will therefore be indexed as a special "AT&amp;T" keyword,
  9573. thanks to the very first entry from the sample.
  9574. </p><p>
  9575. Exceptions also allow to capture special characters (that are exceptions
  9576. from general <a class="link" href="#conf-charset-table" title="12.2.16.&nbsp;charset_table">charset_table</a> rules;
  9577. hence the name). Assume that you generally do not want to treat '+'
  9578. as a valid character, but still want to be able search for some exceptions
  9579. from this rule such as 'C++'. The sample above will do just that, totally
  9580. independent of what characters are in the table and what are not.
  9581. </p><p>
  9582. Exceptions are applied to raw incoming document and query data
  9583. during indexing and searching respectively. Therefore, to pick up
  9584. changes in the file it's required to reindex and restart
  9585. <code class="filename">searchd</code>.
  9586. </p><h4><a name="idp33493312"></a>Example:</h4><pre class="programlisting">
  9587. exceptions = /usr/local/sphinx/data/exceptions.txt
  9588. </pre></div>
  9589. <div class="sect2" title="12.2.15.&nbsp;min_word_len"><div class="titlepage"><div><div><h3 class="title"><a name="conf-min-word-len"></a>12.2.15.&nbsp;min_word_len</h3></div></div></div>
  9590. <p>
  9591. Minimum indexed word length.
  9592. Optional, default is 1 (index everything).
  9593. </p><p>
  9594. Only those words that are not shorter than this minimum will be indexed.
  9595. For instance, if min_word_len is 4, then 'the' won't be indexed, but 'they' will be.
  9596. </p><h4><a name="idp33496640"></a>Example:</h4><pre class="programlisting">
  9597. min_word_len = 4
  9598. </pre></div>
  9599. <div class="sect2" title="12.2.16.&nbsp;charset_table"><div class="titlepage"><div><div><h3 class="title"><a name="conf-charset-table"></a>12.2.16.&nbsp;charset_table</h3></div></div></div>
  9600. <p>
  9601. Accepted characters table, with case folding rules.
  9602. Optional, default value are latin and cyrillic characters.
  9603. </p><p>
  9604. charset_table is the main workhorse of Sphinx tokenizing process,
  9605. ie. the process of extracting keywords from document text or query text.
  9606. It controls what characters are accepted as valid and what are not,
  9607. and how the accepted characters should be transformed (eg. should
  9608. the case be removed or not).
  9609. </p><p>
  9610. You can think of charset_table as of a big table that has a mapping
  9611. for each and every of 100K+ characters in Unicode. By default,
  9612. every character maps to 0, which means that it does not occur
  9613. within keywords and should be treated as a separator. Once
  9614. mentioned in the table, character is mapped to some other
  9615. character (most frequently, either to itself or to a lowercase
  9616. letter), and is treated as a valid keyword part.
  9617. </p><p>
  9618. The expected value format is a commas-separated list of mappings.
  9619. Two simplest mappings simply declare a character as valid, and map
  9620. a single character to another single character, respectively.
  9621. But specifying the whole table in such form would result
  9622. in bloated and barely manageable specifications. So there are
  9623. several syntax shortcuts that let you map ranges of characters
  9624. at once. The complete list is as follows:
  9625. </p><div class="variablelist"><dl><dt><span class="term">A-&gt;a</span></dt>
  9626. <dd><p>Single char mapping, declares source char 'A' as allowed
  9627. to occur within keywords and maps it to destination char 'a'
  9628. (but does <span class="emphasis"><em>not</em></span> declare 'a' as allowed).
  9629. </p></dd><dt><span class="term">A..Z-&gt;a..z</span></dt>
  9630. <dd><p>Range mapping, declares all chars in source range
  9631. as allowed and maps them to the destination range. Does <span class="emphasis"><em>not</em></span>
  9632. declare destination range as allowed. Also checks ranges' lengths
  9633. (the lengths must be equal).
  9634. </p></dd><dt><span class="term">a</span></dt>
  9635. <dd><p>Stray char mapping, declares a character as allowed
  9636. and maps it to itself. Equivalent to a-&gt;a single char mapping.
  9637. </p></dd><dt><span class="term">a..z</span></dt>
  9638. <dd><p>Stray range mapping, declares all characters in range
  9639. as allowed and maps them to themselves. Equivalent to
  9640. a..z-&gt;a..z range mapping.
  9641. </p></dd><dt><span class="term">A..Z/2</span></dt>
  9642. <dd><p>Checkerboard range map. Maps every pair of chars
  9643. to the second char. More formally, declares odd characters
  9644. in range as allowed and maps them to the even ones; also
  9645. declares even characters as allowed and maps them to themselves.
  9646. For instance, A..Z/2 is equivalent to A-&gt;B, B-&gt;B, C-&gt;D, D-&gt;D,
  9647. ..., Y-&gt;Z, Z-&gt;Z. This mapping shortcut is helpful for
  9648. a number of Unicode blocks where uppercase and lowercase
  9649. letters go in such interleaved order instead of contiguous
  9650. chunks.
  9651. </p></dd></dl></div>
  9652. <p>
  9653. </p><p>
  9654. Control characters with codes from 0 to 31 are always treated as separators.
  9655. Characters with codes 32 to 127, ie. 7-bit ASCII characters, can be used
  9656. in the mappings as is. To avoid configuration file encoding issues,
  9657. 8-bit ASCII characters and Unicode characters must be specified in U+xxx form,
  9658. where 'xxx' is hexadecimal codepoint number. This form can also be used
  9659. for 7-bit ASCII characters to encode special ones: eg. use U+20 to
  9660. encode space, U+2E to encode dot, U+2C to encode comma.
  9661. </p><p>
  9662. Starting with 2.2.3-beta, aliases "english" and "russian" are allowed at
  9663. control character mapping.
  9664. </p><h4><a name="idp33512336"></a>Example:</h4><pre class="programlisting">
  9665. # default are English and Russian letters
  9666. charset_table = 0..9, A..Z-&gt;a..z, _, a..z, \
  9667. U+410..U+42F-&gt;U+430..U+44F, U+430..U+44F, U+401-&gt;U+451, U+451
  9668. # english charset defined with alias
  9669. charset_table = 0..9, english, _
  9670. </pre></div>
  9671. <div class="sect2" title="12.2.17.&nbsp;ignore_chars"><div class="titlepage"><div><div><h3 class="title"><a name="conf-ignore-chars"></a>12.2.17.&nbsp;ignore_chars</h3></div></div></div>
  9672. <p>
  9673. Ignored characters list.
  9674. Optional, default is empty.
  9675. </p><p>
  9676. Useful in the cases when some characters, such as soft hyphenation mark (U+00AD),
  9677. should be not just treated as separators but rather fully ignored.
  9678. For example, if '-' is simply not in the charset_table,
  9679. "abc-def" text will be indexed as "abc" and "def" keywords.
  9680. On the contrary, if '-' is added to ignore_chars list, the same
  9681. text will be indexed as a single "abcdef" keyword.
  9682. </p><p>
  9683. The syntax is the same as for <a class="link" href="#conf-charset-table" title="12.2.16.&nbsp;charset_table">charset_table</a>,
  9684. but it's only allowed to declare characters, and not allowed to map them. Also,
  9685. the ignored characters must not be present in charset_table.
  9686. </p><h4><a name="idp33517728"></a>Example:</h4><pre class="programlisting">
  9687. ignore_chars = U+AD
  9688. </pre></div>
  9689. <div class="sect2" title="12.2.18.&nbsp;min_prefix_len"><div class="titlepage"><div><div><h3 class="title"><a name="conf-min-prefix-len"></a>12.2.18.&nbsp;min_prefix_len</h3></div></div></div>
  9690. <p>
  9691. Minimum word prefix length to index.
  9692. Optional, default is 0 (do not index prefixes).
  9693. </p><p>
  9694. Prefix indexing allows to implement wildcard searching by 'wordstart*' wildcards.
  9695. When mininum prefix length is set to a positive number, indexer will index
  9696. all the possible keyword prefixes (ie. word beginnings) in addition to the keywords
  9697. themselves. Too short prefixes (below the minimum allowed length) will not
  9698. be indexed.
  9699. </p><p>
  9700. For instance, indexing a keyword "example" with min_prefix_len=3
  9701. will result in indexing "exa", "exam", "examp", "exampl" prefixes along
  9702. with the word itself. Searches against such index for "exam" will match
  9703. documents that contain "example" word, even if they do not contain "exam"
  9704. on itself. However, indexing prefixes will make the index grow significantly
  9705. (because of many more indexed keywords), and will degrade both indexing
  9706. and searching times.
  9707. </p><p>
  9708. There's no automatic way to rank perfect word matches higher
  9709. in a prefix index, but there's a number of tricks to achieve that.
  9710. First, you can setup two indexes, one with prefix indexing and one
  9711. without it, search through both, and use <a class="link" href="#api-func-setindexweights" title="9.3.6.&nbsp;SetIndexWeights">SetIndexWeights()</a>
  9712. call to combine weights. Second, you can rewriteyour extended-mode queries:
  9713. </p><pre class="programlisting">
  9714. $cl-&gt;Query ( "( keyword | keyword* ) other keywords" );
  9715. </pre><p>
  9716. </p><h4><a name="idp33524352"></a>Example:</h4><pre class="programlisting">
  9717. min_prefix_len = 3
  9718. </pre></div>
  9719. <div class="sect2" title="12.2.19.&nbsp;min_infix_len"><div class="titlepage"><div><div><h3 class="title"><a name="conf-min-infix-len"></a>12.2.19.&nbsp;min_infix_len</h3></div></div></div>
  9720. <p>
  9721. Minimum infix prefix length to index.
  9722. Optional, default is 0 (do not index infixes).
  9723. </p><p>
  9724. Infix indexing allows to implement wildcard searching by 'start*', '*end', and '*middle*' wildcards.
  9725. When minimum infix length is set to a positive number, indexer will index all the possible keyword infixes
  9726. (ie. substrings) in addition to the keywords themselves. Too short infixes
  9727. (below the minimum allowed length) will not be indexed. For instance,
  9728. indexing a keyword "test" with min_infix_len=2 will result in indexing
  9729. "te", "es", "st", "tes", "est" infixes along with the word itself.
  9730. Searches against such index for "es" will match documents that contain
  9731. "test" word, even if they do not contain "es" on itself. However,
  9732. indexing infixes will make the index grow significantly (because of
  9733. many more indexed keywords), and will degrade both indexing and
  9734. searching times.</p><p>
  9735. There's no automatic way to rank perfect word matches higher
  9736. in an infix index, but the same tricks as with <a class="link" href="#conf-min-prefix-len" title="12.2.18.&nbsp;min_prefix_len">prefix indexes</a>
  9737. can be applied.
  9738. </p><h4><a name="idp33529520"></a>Example:</h4><pre class="programlisting">
  9739. min_infix_len = 3
  9740. </pre></div>
  9741. <div class="sect2" title="12.2.20.&nbsp;max_substring_len"><div class="titlepage"><div><div><h3 class="title"><a name="conf-max-substring-len"></a>12.2.20.&nbsp;max_substring_len</h3></div></div></div>
  9742. <p>
  9743. Maximum substring (either prefix or infix) length to index.
  9744. Optional, default is 0 (do not limit indexed substrings).
  9745. Applies to dict=crc only.
  9746. </p><p>
  9747. By default, substring (either prefix or infix) indexing in the
  9748. <a class="link" href="#conf-dict" title="12.2.7.&nbsp;dict">dict=crc mode</a> will index <span class="bold"><strong>all</strong></span>
  9749. the possible substrings as separate keywords. That might result
  9750. in an overly large index. So the <code class="code">max_substring_len</code>
  9751. directive lets you limit the impact of substring indexing
  9752. by skipping too-long substrings (which, chances are, will never
  9753. get searched for anyway).
  9754. </p><p>
  9755. For example, a test index of 10,000 blog posts takes this
  9756. much disk space depending on the settings:
  9757. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">6.4 MB baseline (no substrings)</li>
  9758. <li class="listitem">24.3 MB (3.8x) with min_prefix_len = 3</li>
  9759. <li class="listitem">22.2 MB (3.5x) with min_prefix_len = 3, max_substring_len = 8</li>
  9760. <li class="listitem">19.3 MB (3.0x) with min_prefix_len = 3, max_substring_len = 6</li>
  9761. <li class="listitem">94.3 MB (14.7x) with min_infix_len = 3</li>
  9762. <li class="listitem">84.6 MB (13.2x) with min_infix_len = 3, max_substring_len = 8</li>
  9763. <li class="listitem">70.7 MB (11.0x) with min_infix_len = 3, max_substring_len = 6</li>
  9764. </ul></div>
  9765. <p>
  9766. So in this test limiting the max substring length saved us
  9767. 10-15% on the index size.
  9768. </p><p>
  9769. There is no performance impact associated with substring length
  9770. when using dict=keywords mode, so this directive is not applicable
  9771. and intentionally forbidden in that case. If required, you can still
  9772. limit the length of a substring that you search for in the application
  9773. code.
  9774. </p><h4><a name="idp33539760"></a>Example:</h4><pre class="programlisting">
  9775. max_substring_len = 12
  9776. </pre></div>
  9777. <div class="sect2" title="12.2.21.&nbsp;prefix_fields"><div class="titlepage"><div><div><h3 class="title"><a name="conf-prefix-fields"></a>12.2.21.&nbsp;prefix_fields</h3></div></div></div>
  9778. <p>
  9779. The list of full-text fields to limit prefix indexing to.
  9780. Optional, default is empty (index all fields in prefix mode).
  9781. </p><p>
  9782. Because prefix indexing impacts both indexing and searching performance,
  9783. it might be desired to limit it to specific full-text fields only:
  9784. for instance, to provide prefix searching through URLs, but not through
  9785. page contents. prefix_fields specifies what fields will be prefix-indexed;
  9786. all other fields will be indexed in normal mode. The value format is a
  9787. comma-separated list of field names.
  9788. </p><h4><a name="idp33543360"></a>Example:</h4><pre class="programlisting">
  9789. prefix_fields = url, domain
  9790. </pre></div>
  9791. <div class="sect2" title="12.2.22.&nbsp;infix_fields"><div class="titlepage"><div><div><h3 class="title"><a name="conf-infix-fields"></a>12.2.22.&nbsp;infix_fields</h3></div></div></div>
  9792. <p>
  9793. The list of full-text fields to limit infix indexing to.
  9794. Optional, default is empty (index all fields in infix mode).
  9795. </p><p>
  9796. Similar to <a class="link" href="#conf-prefix-fields" title="12.2.21.&nbsp;prefix_fields">prefix_fields</a>,
  9797. but lets you limit infix-indexing to given fields.
  9798. </p><h4><a name="idp33547552"></a>Example:</h4><pre class="programlisting">
  9799. infix_fields = url, domain
  9800. </pre></div>
  9801. <div class="sect2" title="12.2.23.&nbsp;ngram_len"><div class="titlepage"><div><div><h3 class="title"><a name="conf-ngram-len"></a>12.2.23.&nbsp;ngram_len</h3></div></div></div>
  9802. <p>
  9803. N-gram lengths for N-gram indexing.
  9804. Optional, default is 0 (disable n-gram indexing).
  9805. Known values are 0 and 1 (other lengths to be implemented).
  9806. </p><p>
  9807. N-grams provide basic CJK (Chinese, Japanese, Korean) support for
  9808. unsegmented texts. The issue with CJK searching is that there could be no
  9809. clear separators between the words. Ideally, the texts would be filtered
  9810. through a special program called segmenter that would insert separators
  9811. in proper locations. However, segmenters are slow and error prone,
  9812. and it's common to index contiguous groups of N characters, or n-grams,
  9813. instead.
  9814. </p><p>
  9815. When this feature is enabled, streams of CJK characters are indexed
  9816. as N-grams. For example, if incoming text is "ABCDEF" (where A to F represent
  9817. some CJK characters) and length is 1, in will be indexed as if
  9818. it was "A B C D E F". (With length equal to 2, it would produce "AB BC CD DE EF";
  9819. but only 1 is supported at the moment.) Only those characters that are
  9820. listed in <a class="link" href="#conf-ngram-chars" title="12.2.24.&nbsp;ngram_chars">ngram_chars</a> table
  9821. will be split this way; other ones will not be affected.
  9822. </p><p>
  9823. Note that if search query is segmented, ie. there are separators between
  9824. individual words, then wrapping the words in quotes and using extended mode
  9825. will result in proper matches being found even if the text was <span class="bold"><strong>not</strong></span>
  9826. segmented. For instance, assume that the original query is BC&nbsp;DEF.
  9827. After wrapping in quotes on the application side, it should look
  9828. like "BC"&nbsp;"DEF" (<span class="emphasis"><em>with</em></span> quotes). This query
  9829. will be passed to Sphinx and internally split into 1-grams too,
  9830. resulting in "B&nbsp;C"&nbsp;"D&nbsp;E&nbsp;F" query, still with
  9831. quotes that are the phrase matching operator. And it will match
  9832. the text even though there were no separators in the text.
  9833. </p><p>
  9834. Even if the search query is not segmented, Sphinx should still produce
  9835. good results, thanks to phrase based ranking: it will pull closer phrase
  9836. matches (which in case of N-gram CJK words can mean closer multi-character
  9837. word matches) to the top.
  9838. </p><h4><a name="idp33556432"></a>Example:</h4><pre class="programlisting">
  9839. ngram_len = 1
  9840. </pre></div>
  9841. <div class="sect2" title="12.2.24.&nbsp;ngram_chars"><div class="titlepage"><div><div><h3 class="title"><a name="conf-ngram-chars"></a>12.2.24.&nbsp;ngram_chars</h3></div></div></div>
  9842. <p>
  9843. N-gram characters list.
  9844. Optional, default is empty.
  9845. </p><p>
  9846. To be used in conjunction with in <a class="link" href="#conf-ngram-len" title="12.2.23.&nbsp;ngram_len">ngram_len</a>,
  9847. this list defines characters, sequences of which are subject to N-gram extraction.
  9848. Words comprised of other characters will not be affected by N-gram indexing
  9849. feature. The value format is identical to <a class="link" href="#conf-charset-table" title="12.2.16.&nbsp;charset_table">charset_table</a>.
  9850. </p><h4><a name="idp33561344"></a>Example:</h4><pre class="programlisting">
  9851. ngram_chars = U+3000..U+2FA1F
  9852. </pre></div>
  9853. <div class="sect2" title="12.2.25.&nbsp;phrase_boundary"><div class="titlepage"><div><div><h3 class="title"><a name="conf-phrase-boundary"></a>12.2.25.&nbsp;phrase_boundary</h3></div></div></div>
  9854. <p>
  9855. Phrase boundary characters list.
  9856. Optional, default is empty.
  9857. </p><p>
  9858. This list controls what characters will be treated as phrase boundaries,
  9859. in order to adjust word positions and enable phrase-level search
  9860. emulation through proximity search. The syntax is similar
  9861. to <a class="link" href="#conf-charset-table" title="12.2.16.&nbsp;charset_table">charset_table</a>.
  9862. Mappings are not allowed and the boundary characters must not
  9863. overlap with anything else.
  9864. </p><p>
  9865. On phrase boundary, additional word position increment (specified by
  9866. <a class="link" href="#conf-phrase-boundary-step" title="12.2.26.&nbsp;phrase_boundary_step">phrase_boundary_step</a>)
  9867. will be added to current word position. This enables phrase-level
  9868. searching through proximity queries: words in different phrases
  9869. will be guaranteed to be more than phrase_boundary_step distance
  9870. away from each other; so proximity search within that distance
  9871. will be equivalent to phrase-level search.
  9872. </p><p>
  9873. Phrase boundary condition will be raised if and only if such character
  9874. is followed by a separator; this is to avoid abbreviations such as
  9875. S.T.A.L.K.E.R or URLs being treated as several phrases.
  9876. </p><h4><a name="idp33567984"></a>Example:</h4><pre class="programlisting">
  9877. phrase_boundary = ., ?, !, U+2026 # horizontal ellipsis
  9878. </pre></div>
  9879. <div class="sect2" title="12.2.26.&nbsp;phrase_boundary_step"><div class="titlepage"><div><div><h3 class="title"><a name="conf-phrase-boundary-step"></a>12.2.26.&nbsp;phrase_boundary_step</h3></div></div></div>
  9880. <p>
  9881. Phrase boundary word position increment.
  9882. Optional, default is 0.
  9883. </p><p>
  9884. On phrase boundary, current word position will be additionally incremented
  9885. by this number. See <a class="link" href="#conf-phrase-boundary" title="12.2.25.&nbsp;phrase_boundary">phrase_boundary</a> for details.
  9886. </p><h4><a name="idp33571952"></a>Example:</h4><pre class="programlisting">
  9887. phrase_boundary_step = 100
  9888. </pre></div>
  9889. <div class="sect2" title="12.2.27.&nbsp;html_strip"><div class="titlepage"><div><div><h3 class="title"><a name="conf-html-strip"></a>12.2.27.&nbsp;html_strip</h3></div></div></div>
  9890. <p>
  9891. Whether to strip HTML markup from incoming full-text data.
  9892. Optional, default is 0.
  9893. Known values are 0 (disable stripping) and 1 (enable stripping).
  9894. </p><p>
  9895. Both HTML tags and entities and considered markup and get processed.
  9896. </p><p>HTML tags are removed, their contents (i.e., everything between
  9897. &lt;P&gt; and &lt;/P&gt;) are left intact by default. You can choose
  9898. to keep and index attributes of the tags (e.g., HREF attribute in
  9899. an A tag, or ALT in an IMG one). Several well-known inline tags are
  9900. completely removed, all other tags are treated as block level and
  9901. replaced with whitespace. For example, 'te&lt;B&gt;st&lt;/B&gt;'
  9902. text will be indexed as a single keyword 'test', however,
  9903. 'te&lt;P&gt;st&lt;/P&gt;' will be indexed as two keywords
  9904. 'te' and 'st'. Known inline tags are as follows: A, B, I, S, U, BASEFONT,
  9905. BIG, EM, FONT, IMG, LABEL, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TT.
  9906. </p><p>
  9907. HTML entities get decoded and replaced with corresponding UTF-8
  9908. characters. Stripper supports both numeric forms (such as &amp;#239;)
  9909. and text forms (such as &amp;oacute; or &amp;nbsp;). All entities
  9910. as specified by HTML4 standard are supported.
  9911. </p><p>
  9912. Stripping should work with
  9913. properly formed HTML and XHTML, but, just as most browsers, may produce
  9914. unexpected results on malformed input (such as HTML with stray &lt;'s
  9915. or unclosed &gt;'s).
  9916. </p><p>
  9917. Only the tags themselves, and also HTML comments, are stripped.
  9918. To strip the contents of the tags too (eg. to strip embedded scripts),
  9919. see <a class="link" href="#conf-html-remove-elements" title="12.2.29.&nbsp;html_remove_elements">html_remove_elements</a> option.
  9920. There are no restrictions on tag names; ie. everything
  9921. that looks like a valid tag start, or end, or a comment
  9922. will be stripped.
  9923. </p><h4><a name="idp33579504"></a>Example:</h4><pre class="programlisting">
  9924. html_strip = 1
  9925. </pre></div>
  9926. <div class="sect2" title="12.2.28.&nbsp;html_index_attrs"><div class="titlepage"><div><div><h3 class="title"><a name="conf-html-index-attrs"></a>12.2.28.&nbsp;html_index_attrs</h3></div></div></div>
  9927. <p>
  9928. A list of markup attributes to index when stripping HTML.
  9929. Optional, default is empty (do not index markup attributes).
  9930. </p><p>
  9931. Specifies HTML markup attributes whose contents should be retained and indexed
  9932. even though other HTML markup is stripped. The format is per-tag enumeration of
  9933. indexable attributes, as shown in the example below.
  9934. </p><h4><a name="idp33582848"></a>Example:</h4><pre class="programlisting">
  9935. html_index_attrs = img=alt,title; a=title;
  9936. </pre></div>
  9937. <div class="sect2" title="12.2.29.&nbsp;html_remove_elements"><div class="titlepage"><div><div><h3 class="title"><a name="conf-html-remove-elements"></a>12.2.29.&nbsp;html_remove_elements</h3></div></div></div>
  9938. <p>
  9939. A list of HTML elements for which to strip contents along with the elements themselves.
  9940. Optional, default is empty string (do not strip contents of any elements).
  9941. </p><p>
  9942. This feature allows to strip element contents, ie. everything that
  9943. is between the opening and the closing tags. It is useful to remove
  9944. embedded scripts, CSS, etc. Short tag form for empty elements
  9945. (ie. &lt;br /&gt;) is properly supported; ie. the text that
  9946. follows such tag will <span class="bold"><strong>not</strong></span> be removed.
  9947. </p><p>
  9948. The value is a comma-separated list of element (tag) names whose
  9949. contents should be removed. Tag names are case insensitive.
  9950. </p><h4><a name="idp33587760"></a>Example:</h4><pre class="programlisting">
  9951. html_remove_elements = style, script
  9952. </pre></div>
  9953. <div class="sect2" title="12.2.30.&nbsp;local"><div class="titlepage"><div><div><h3 class="title"><a name="conf-local"></a>12.2.30.&nbsp;local</h3></div></div></div>
  9954. <p>
  9955. Local index declaration in the <a class="link" href="#distributed" title="5.8.&nbsp;Distributed searching">distributed index</a>.
  9956. Multi-value, optional, default is empty.
  9957. </p><p>
  9958. This setting is used to declare local indexes that will be searched when
  9959. given distributed index is searched. Many local indexes can be declared per
  9960. each distributed index. Any local index can also be mentioned several times
  9961. in different distributed indexes.
  9962. </p><p>
  9963. Note that by default all local indexes will be searched <span class="bold"><strong>sequentially</strong></span>,
  9964. utilizing only 1 CPU or core. To parallelize processing of the local parts
  9965. in the distributed index, you should use <code class="option">dist_threads</code> directive,
  9966. see <a class="xref" href="#conf-dist-threads" title="12.4.24.&nbsp;dist_threads">Section&nbsp;12.4.24, &#8220;dist_threads&#8221;</a>.
  9967. </p><p>
  9968. Before <code class="option">dist_threads</code>, there also was a legacy solution
  9969. to configure <code class="filename">searchd</code> to query itself instead of using
  9970. local indexes (refer to <a class="xref" href="#conf-agent" title="12.2.31.&nbsp;agent">Section&nbsp;12.2.31, &#8220;agent&#8221;</a> for the details). However,
  9971. that creates redundant CPU and network load, and <code class="option">dist_threads</code>
  9972. is now strongly suggested instead.
  9973. </p><h4><a name="idp33597120"></a>Example:</h4><pre class="programlisting">
  9974. local = chunk1
  9975. local = chunk2
  9976. </pre></div>
  9977. <div class="sect2" title="12.2.31.&nbsp;agent"><div class="titlepage"><div><div><h3 class="title"><a name="conf-agent"></a>12.2.31.&nbsp;agent</h3></div></div></div>
  9978. <p>
  9979. Remote agent declaration in the <a class="link" href="#distributed" title="5.8.&nbsp;Distributed searching">distributed index</a>.
  9980. Multi-value, optional, default is empty.
  9981. </p><p>
  9982. <code class="code">agent</code> directive declares remote agents that are searched
  9983. every time when the enclosing distributed index is searched. The agents
  9984. are, essentially, pointers to networked indexes. Prior to version 2.1.1-beta,
  9985. the value format was:
  9986. </p><pre class="programlisting">
  9987. agent = address:index-list
  9988. </pre><p>
  9989. Starting with 2.1.1-beta, the value can additionally specify multiple
  9990. alternatives (agent mirrors) for either the address only, or the address
  9991. and index list:
  9992. </p><pre class="programlisting">
  9993. agent = address1 [ | address2 [...] ]:index-list
  9994. agent = address1:index-list [ | address2:index-list [...] ]
  9995. </pre><p>
  9996. In both cases the address specification must be one of the following:
  9997. </p><pre class="programlisting">
  9998. address = hostname:port # eg. server2:9312
  9999. address = /absolute/unix/socket/path # eg. /var/run/sphinx2.sock
  10000. </pre><p>
  10001. Where
  10002. <code class="code">hostname</code> is the remote host name,
  10003. <code class="code">port</code> is the remote TCP port number,
  10004. <code class="code">index-list</code> is a comma-separated list of index names,
  10005. and square braces [] designate an optional clause.
  10006. </p><p>
  10007. In other words, you can point every single agent to one or more remote
  10008. indexes, residing on one or more networked servers. There are absolutely
  10009. no restrictions on the pointers. To point out a couple important things,
  10010. the host can be localhost, and the remote index can be a distributed
  10011. index in turn, all that is legal. That enables a bunch of very different
  10012. usage modes:
  10013. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>sharding over multiple agent servers, and creating
  10014. an arbitrary cluster topology;</p></li>
  10015. <li class="listitem"><p>sharding over multiple agent servers, mirrored
  10016. for HA/LB (High Availability and Load Balancing) purposes
  10017. (starting with 2.1.1-beta);</p></li>
  10018. <li class="listitem"><p>sharding within localhost, to utilize multiple cores
  10019. (historical and not recommended in versions 1.x and above, use multiple
  10020. local indexes and dist_threads directive instead);</p></li>
  10021. </ul></div>
  10022. <p>
  10023. </p><p>
  10024. All agents are searched in parallel. An index list is passed verbatim
  10025. to the remote agent. How exactly that list is searched within the agent
  10026. (ie. sequentially or in parallel too) depends solely on the agent
  10027. configuration (ie. dist_threads directive). Master has no remote
  10028. control over that.
  10029. </p><h4><a name="idp33609504"></a>Example:</h4><pre class="programlisting">
  10030. # config on box2
  10031. # sharding an index over 3 servers
  10032. agent = box2:9312:chunk2
  10033. agent = box3:9312:chunk3
  10034. # config on box2
  10035. # sharding an index over 3 servers
  10036. agent = box1:9312:chunk2
  10037. agent = box3:9312:chunk3
  10038. # config on box3
  10039. # sharding an index over 3 servers
  10040. agent = box1:9312:chunk2
  10041. agent = box2:9312:chunk3
  10042. </pre><h4><a name="idp33610896"></a>Agent mirrors</h4><p>
  10043. New syntax added in 2.1.1-beta lets you define so-called <span class="bold"><strong>agent mirrors</strong></span>
  10044. that can be used interchangeably when processing a search query. Master server
  10045. keeps track of mirror status (alive or dead) and response times, and does
  10046. automatic failover and load balancing based on that. For example, this line:</p><pre class="programlisting">
  10047. agent = box1:9312|box2:9312|box3:9312:chunk2
  10048. </pre><p>Declares that box1:9312, box2:9312, and box3:9312 all have an index
  10049. called chunk2, and can be used as interchangeable mirrors. If any single
  10050. of those servers go down, the queries will be distributed between
  10051. the other two. When it gets back up, master will detect that and begin
  10052. routing queries to all three boxes again.
  10053. </p><p>
  10054. Another way to define the mirrors is to explicitly specify the index list
  10055. for every mirror:</p><pre class="programlisting">
  10056. agent = box1:9312:box1chunk2|box2:9312:box2chunk2
  10057. </pre><p>This works essentially the same as the previous example, but different
  10058. index names will be used when querying different severs: box1chunk2 when querying
  10059. box1:9312, and box2chunk when querying box2:9312.
  10060. </p><p>
  10061. By default, all queries are routed to the best of the mirrors. The best one
  10062. is picked based on the recent statistics, as controlled by the
  10063. <a class="link" href="#conf-ha-period-karma" title="12.4.40.&nbsp;ha_period_karma">ha_period_karma</a> config directive.
  10064. Master stores a number of metrics (total query count, error count, response
  10065. time, etc) recently observed for every agent. It groups those by time spans,
  10066. and karma is that time span length. The best agent mirror is then determined
  10067. dynamically based on the last 2 such time spans. Specific algorithm that
  10068. will be used to pick a mirror can be configured
  10069. <a class="link" href="#conf-ha-strategy" title="12.2.60.&nbsp;ha_strategy">ha_strategy</a> directive.
  10070. </p><p>
  10071. The karma period is in seconds and defaults to 60 seconds. Master stores
  10072. upto 15 karma spans with per-agent statistics for instrumentation purposes
  10073. (see <a class="link" href="#sphinxql-show-agent-status" title="8.29.&nbsp;SHOW AGENT STATUS">SHOW AGENT STATUS</a>
  10074. statement). However, only the last 2 spans out of those are ever used for
  10075. HA/LB logic.
  10076. </p><p>
  10077. When there are no queries, master sends a regular ping command every
  10078. <a class="link" href="#conf-ha-ping-interval" title="12.4.39.&nbsp;ha_ping_interval">ha_ping_interval</a> milliseconds
  10079. in order to have some statistics and at least check, whether the remote
  10080. host is still alive. ha_ping_interval defaults to 1000 msec. Setting it to 0
  10081. disables pings and statistics will only be accumulated based on actual queries.
  10082. </p><h4><a name="idp33621808"></a>Example:</h4><pre class="programlisting">
  10083. # sharding index over 4 servers total
  10084. # in just 2 chunks but with 2 failover mirrors for each chunk
  10085. # box1, box2 carry chunk1 as local
  10086. # box3, box4 carry chunk2 as local
  10087. # config on box1, box2
  10088. agent = box3:9312|box4:9312:chunk2
  10089. # config on box3, box4
  10090. agent = box1:9312|box2:9312:chunk1
  10091. </pre></div>
  10092. <div class="sect2" title="12.2.32.&nbsp;agent_persistent"><div class="titlepage"><div><div><h3 class="title"><a name="conf-agent-persistent"></a>12.2.32.&nbsp;agent_persistent</h3></div></div></div>
  10093. <p>
  10094. Persistently connected remote agent declaration.
  10095. Multi-value, optional, default is empty.
  10096. Introduced in version 2.1.1-beta.
  10097. </p><p>
  10098. <code class="option">agent_persistent</code> directive syntax matches that of
  10099. the <a class="link" href="#conf-agent" title="12.2.31.&nbsp;agent">agent</a> directive. The only difference
  10100. is that the master will <span class="bold"><strong>not</strong></span> open a new connection to the agent for
  10101. every query and then close it. Rather, it will keep a connection open and
  10102. attempt to reuse for the subsequent queries. The maximal number of such persistent connections per one agent host
  10103. is limited by <a class="link" href="#conf-persistent-connections-limit" title="12.4.41.&nbsp;persistent_connections_limit">persistent_connections_limit</a> option of searchd section.
  10104. </p><p>
  10105. Note, that you <span class="bold"><strong>have</strong></span> to set the last one in something greater than 0 if you want to use persistent agent connections.
  10106. Otherwise - when <a class="link" href="#conf-persistent-connections-limit" title="12.4.41.&nbsp;persistent_connections_limit">persistent_connections_limit</a> is not defined, it assumes
  10107. the zero num of persistent connections, and 'agent_persistent' acts exactly as simple 'agent'.
  10108. </p><p>
  10109. Persistent master-agent connections reduce TCP port pressure, and
  10110. save on connection handshakes. As of time of this writing, they are supported <span class="bold"><strong>only</strong></span>
  10111. in workers=threads mode. In other modes, simple non-persistent connections
  10112. (i.e., one connection per operation) will be used, and a warning will show
  10113. up in the console.
  10114. </p><h4><a name="idp33632112"></a>Example:</h4><pre class="programlisting">
  10115. agent_persistent = remotebox:9312:index2
  10116. </pre></div>
  10117. <div class="sect2" title="12.2.33.&nbsp;agent_blackhole"><div class="titlepage"><div><div><h3 class="title"><a name="conf-agent-blackhole"></a>12.2.33.&nbsp;agent_blackhole</h3></div></div></div>
  10118. <p>
  10119. Remote blackhole agent declaration in the <a class="link" href="#distributed" title="5.8.&nbsp;Distributed searching">distributed index</a>.
  10120. Multi-value, optional, default is empty.
  10121. Introduced in version 0.9.9-rc1.
  10122. </p><p>
  10123. <code class="option">agent_blackhole</code> lets you fire-and-forget queries
  10124. to remote agents. That is useful for debugging (or just testing)
  10125. production clusters: you can setup a separate debugging/testing searchd
  10126. instance, and forward the requests to this instance from your production
  10127. master (aggregator) instance without interfering with production work.
  10128. Master searchd will attempt to connect and query blackhole agent
  10129. normally, but it will neither wait nor process any responses.
  10130. Also, all network errors on blackhole agents will be ignored.
  10131. The value format is completely identical to regular
  10132. <a class="link" href="#conf-agent" title="12.2.31.&nbsp;agent">agent</a> directive.
  10133. </p><h4><a name="idp33637904"></a>Example:</h4><pre class="programlisting">
  10134. agent_blackhole = testbox:9312:testindex1,testindex2
  10135. </pre></div>
  10136. <div class="sect2" title="12.2.34.&nbsp;agent_connect_timeout"><div class="titlepage"><div><div><h3 class="title"><a name="conf-agent-connect-timeout"></a>12.2.34.&nbsp;agent_connect_timeout</h3></div></div></div>
  10137. <p>
  10138. Remote agent connection timeout, in milliseconds.
  10139. Optional, default is 1000 (ie. 1 second).
  10140. </p><p>
  10141. When connecting to remote agents, <code class="filename">searchd</code>
  10142. will wait at most this much time for connect() call to complete
  10143. successfully. If the timeout is reached but connect() does not complete,
  10144. and <a class="link" href="#api-func-setretries" title="9.1.4.&nbsp;SetRetries">retries</a> are enabled,
  10145. retry will be initiated.
  10146. </p><h4><a name="idp33642912"></a>Example:</h4><pre class="programlisting">
  10147. agent_connect_timeout = 300
  10148. </pre></div>
  10149. <div class="sect2" title="12.2.35.&nbsp;agent_query_timeout"><div class="titlepage"><div><div><h3 class="title"><a name="conf-agent-query-timeout"></a>12.2.35.&nbsp;agent_query_timeout</h3></div></div></div>
  10150. <p>
  10151. Remote agent query timeout, in milliseconds.
  10152. Optional, default is 3000 (ie. 3 seconds).
  10153. Added in version 2.1.1-beta.
  10154. </p><p>
  10155. After connection, <code class="filename">searchd</code> will wait at most this
  10156. much time for remote queries to complete. This timeout is fully separate
  10157. from connection timeout; so the maximum possible delay caused by
  10158. a remote agent equals to the sum of <code class="code">agent_connection_timeout</code> and
  10159. <code class="code">agent_query_timeout</code>. Queries will <span class="bold"><strong>not</strong></span> be retried
  10160. if this timeout is reached; a warning will be produced instead.
  10161. </p><h4><a name="idp33648656"></a>Example:</h4><pre class="programlisting">
  10162. agent_query_timeout = 10000 # our query can be long, allow up to 10 sec
  10163. </pre></div>
  10164. <div class="sect2" title="12.2.36.&nbsp;preopen"><div class="titlepage"><div><div><h3 class="title"><a name="conf-preopen"></a>12.2.36.&nbsp;preopen</h3></div></div></div>
  10165. <p>
  10166. Whether to pre-open all index files, or open them per each query.
  10167. Optional, default is 0 (do not preopen).
  10168. </p><p>
  10169. This option tells <code class="filename">searchd</code> that it should pre-open
  10170. all index files on startup (or rotation) and keep them open while it runs.
  10171. Currently, the default mode is <span class="bold"><strong>not</strong></span> to pre-open the files (this may
  10172. change in the future). Preopened indexes take a few (currently 2) file
  10173. descriptors per index. However, they save on per-query <code class="code">open()</code> calls;
  10174. and also they are invulnerable to subtle race conditions that may happen during
  10175. index rotation under high load. On the other hand, when serving many indexes
  10176. (100s to 1000s), it still might be desired to open the on per-query basis
  10177. in order to save file descriptors.
  10178. </p><p>
  10179. This directive does not affect <code class="filename">indexer</code> in any way,
  10180. it only affects <code class="filename">searchd</code>.
  10181. </p><h4><a name="idp33656128"></a>Example:</h4><pre class="programlisting">
  10182. preopen = 1
  10183. </pre></div>
  10184. <div class="sect2" title="12.2.37.&nbsp;inplace_enable"><div class="titlepage"><div><div><h3 class="title"><a name="conf-inplace-enable"></a>12.2.37.&nbsp;inplace_enable</h3></div></div></div>
  10185. <p>
  10186. Whether to enable in-place index inversion.
  10187. Optional, default is 0 (use separate temporary files).
  10188. Introduced in version 0.9.9-rc1.
  10189. </p><p>
  10190. <code class="option">inplace_enable</code> greatly reduces indexing disk footprint,
  10191. at a cost of slightly slower indexing (it uses around 2x less disk,
  10192. but yields around 90-95% the original performance).
  10193. </p><p>
  10194. Indexing involves two major phases. The first phase collects,
  10195. processes, and partially sorts documents by keyword, and writes
  10196. the intermediate result to temporary files (.tmp*). The second
  10197. phase fully sorts the documents, and creates the final index
  10198. files. Thus, rebuilding a production index on the fly involves
  10199. around 3x peak disk footprint: 1st copy for the intermediate
  10200. temporary files, 2nd copy for newly constructed copy, and 3rd copy
  10201. for the old index that will be serving production queries in the meantime.
  10202. (Intermediate data is comparable in size to the final index.)
  10203. That might be too much disk footprint for big data collections,
  10204. and <code class="option">inplace_enable</code> allows to reduce it.
  10205. When enabled, it reuses the temporary files, outputs the
  10206. final data back to them, and renames them on completion.
  10207. However, this might require additional temporary data chunk
  10208. relocation, which is where the performance impact comes from.
  10209. </p><p>
  10210. This directive does not affect <code class="filename">searchd</code> in any way,
  10211. it only affects <code class="filename">indexer</code>.
  10212. </p><h4><a name="idp33663408"></a>Example:</h4><pre class="programlisting">
  10213. inplace_enable = 1
  10214. </pre></div>
  10215. <div class="sect2" title="12.2.38.&nbsp;inplace_hit_gap"><div class="titlepage"><div><div><h3 class="title"><a name="conf-inplace-hit-gap"></a>12.2.38.&nbsp;inplace_hit_gap</h3></div></div></div>
  10216. <p>
  10217. <a class="link" href="#conf-inplace-enable" title="12.2.37.&nbsp;inplace_enable">In-place inversion</a> fine-tuning option.
  10218. Controls preallocated hitlist gap size.
  10219. Optional, default is 0.
  10220. Introduced in version 0.9.9-rc1.
  10221. </p><p>
  10222. This directive does not affect <code class="filename">searchd</code> in any way,
  10223. it only affects <code class="filename">indexer</code>.
  10224. </p><h4><a name="idp33668848"></a>Example:</h4><pre class="programlisting">
  10225. inplace_hit_gap = 1M
  10226. </pre></div>
  10227. <div class="sect2" title="12.2.39.&nbsp;inplace_docinfo_gap"><div class="titlepage"><div><div><h3 class="title"><a name="conf-inplace-docinfo-gap"></a>12.2.39.&nbsp;inplace_docinfo_gap</h3></div></div></div>
  10228. <p>
  10229. <a class="link" href="#conf-inplace-enable" title="12.2.37.&nbsp;inplace_enable">In-place inversion</a> fine-tuning option.
  10230. Controls preallocated docinfo gap size.
  10231. Optional, default is 0.
  10232. Introduced in version 0.9.9-rc1.
  10233. </p><p>
  10234. This directive does not affect <code class="filename">searchd</code> in any way,
  10235. it only affects <code class="filename">indexer</code>.
  10236. </p><h4><a name="idp33674192"></a>Example:</h4><pre class="programlisting">
  10237. inplace_docinfo_gap = 1M
  10238. </pre></div>
  10239. <div class="sect2" title="12.2.40.&nbsp;inplace_reloc_factor"><div class="titlepage"><div><div><h3 class="title"><a name="conf-inplace-reloc-factor"></a>12.2.40.&nbsp;inplace_reloc_factor</h3></div></div></div>
  10240. <p>
  10241. <a class="link" href="#conf-inplace-reloc-factor" title="12.2.40.&nbsp;inplace_reloc_factor">In-place inversion</a> fine-tuning option.
  10242. Controls relocation buffer size within indexing memory arena.
  10243. Optional, default is 0.1.
  10244. Introduced in version 0.9.9-rc1.
  10245. </p><p>
  10246. This directive does not affect <code class="filename">searchd</code> in any way,
  10247. it only affects <code class="filename">indexer</code>.
  10248. </p><h4><a name="idp33679856"></a>Example:</h4><pre class="programlisting">
  10249. inplace_reloc_factor = 0.1
  10250. </pre></div>
  10251. <div class="sect2" title="12.2.41.&nbsp;inplace_write_factor"><div class="titlepage"><div><div><h3 class="title"><a name="conf-inplace-write-factor"></a>12.2.41.&nbsp;inplace_write_factor</h3></div></div></div>
  10252. <p>
  10253. <a class="link" href="#conf-inplace-write-factor" title="12.2.41.&nbsp;inplace_write_factor">In-place inversion</a> fine-tuning option.
  10254. Controls in-place write buffer size within indexing memory arena.
  10255. Optional, default is 0.1.
  10256. Introduced in version 0.9.9-rc1.
  10257. </p><p>
  10258. This directive does not affect <code class="filename">searchd</code> in any way,
  10259. it only affects <code class="filename">indexer</code>.
  10260. </p><h4><a name="idp33685520"></a>Example:</h4><pre class="programlisting">
  10261. inplace_write_factor = 0.1
  10262. </pre></div>
  10263. <div class="sect2" title="12.2.42.&nbsp;index_exact_words"><div class="titlepage"><div><div><h3 class="title"><a name="conf-index-exact-words"></a>12.2.42.&nbsp;index_exact_words</h3></div></div></div>
  10264. <p>
  10265. Whether to index the original keywords along with the stemmed/remapped versions.
  10266. Optional, default is 0 (do not index).
  10267. Introduced in version 0.9.9-rc1.
  10268. </p><p>
  10269. When enabled, <code class="option">index_exact_words</code> forces <code class="filename">indexer</code>
  10270. to put the raw keywords in the index along with the stemmed versions. That, in turn,
  10271. enables <a class="link" href="#extended-syntax" title="5.3.&nbsp;Extended query syntax">exact form operator</a> in the query language to work.
  10272. This impacts the index size and the indexing time. However, searching performance
  10273. is not impacted at all.
  10274. </p><h4><a name="idp33690864"></a>Example:</h4><pre class="programlisting">
  10275. index_exact_words = 1
  10276. </pre></div>
  10277. <div class="sect2" title="12.2.43.&nbsp;overshort_step"><div class="titlepage"><div><div><h3 class="title"><a name="conf-overshort-step"></a>12.2.43.&nbsp;overshort_step</h3></div></div></div>
  10278. <p>
  10279. Position increment on overshort (less that <a class="link" href="#conf-min-word-len" title="12.2.15.&nbsp;min_word_len">min_word_len</a>) keywords.
  10280. Optional, allowed values are 0 and 1, default is 1.
  10281. Introduced in version 0.9.9-rc1.
  10282. </p><p>
  10283. This directive does not affect <code class="filename">searchd</code> in any way,
  10284. it only affects <code class="filename">indexer</code>.
  10285. </p><h4><a name="idp33696464"></a>Example:</h4><pre class="programlisting">
  10286. overshort_step = 1
  10287. </pre></div>
  10288. <div class="sect2" title="12.2.44.&nbsp;stopword_step"><div class="titlepage"><div><div><h3 class="title"><a name="conf-stopword-step"></a>12.2.44.&nbsp;stopword_step</h3></div></div></div>
  10289. <p>
  10290. Position increment on <a class="link" href="#conf-stopwords" title="12.2.11.&nbsp;stopwords">stopwords</a>.
  10291. Optional, allowed values are 0 and 1, default is 1.
  10292. Introduced in version 0.9.9-rc1.
  10293. </p><p>
  10294. This directive does not affect <code class="filename">searchd</code> in any way,
  10295. it only affects <code class="filename">indexer</code>.
  10296. </p><h4><a name="idp33701840"></a>Example:</h4><pre class="programlisting">
  10297. stopword_step = 1
  10298. </pre></div>
  10299. <div class="sect2" title="12.2.45.&nbsp;hitless_words"><div class="titlepage"><div><div><h3 class="title"><a name="conf-hitless-words"></a>12.2.45.&nbsp;hitless_words</h3></div></div></div>
  10300. <p>
  10301. Hitless words list.
  10302. Optional, allowed values are 'all', or a list file name.
  10303. Introduced in version 1.10-beta.
  10304. </p><p>
  10305. By default, Sphinx full-text index stores not only a list of matching
  10306. documents for every given keyword, but also a list of its in-document positions
  10307. (aka hitlist). Hitlists enables phrase, proximity, strict order and other
  10308. advanced types of searching, as well as phrase proximity ranking. However,
  10309. hitlists for specific frequent keywords (that can not be stopped for
  10310. some reason despite being frequent) can get huge and thus slow to process
  10311. while querying. Also, in some cases we might only care about boolean
  10312. keyword matching, and never need position-based searching operators
  10313. (such as phrase matching) nor phrase ranking.
  10314. </p><p>
  10315. <code class="option">hitless_words</code> lets you create indexes that either
  10316. do not have positional information (hitlists) at all, or skip it for
  10317. specific keywords.
  10318. </p><p>
  10319. Hitless index will generally use less space than the respective
  10320. regular index (about 1.5x can be expected). Both indexing and searching
  10321. should be faster, at a cost of missing positional query and ranking support.
  10322. When searching, positional queries (eg. phrase queries) will be automatically
  10323. converted to respective non-positional (document-level) or combined queries.
  10324. For instance, if keywords "hello" and "world" are hitless, "hello world"
  10325. phrase query will be converted to (hello &amp; world) bag-of-words query,
  10326. matching all documents that mention either of the keywords but not necessarily
  10327. the exact phrase. And if, in addition, keywords "simon" and "says" are not
  10328. hitless, "simon says hello world" will be converted to ("simon says" &amp;
  10329. hello &amp; world) query, matching all documents that contain "hello" and
  10330. "world" anywhere in the document, and also "simon says" as an exact phrase.
  10331. </p><h4><a name="idp33708528"></a>Example:</h4><pre class="programlisting">
  10332. hitless_words = all
  10333. </pre></div>
  10334. <div class="sect2" title="12.2.46.&nbsp;expand_keywords"><div class="titlepage"><div><div><h3 class="title"><a name="conf-expand-keywords"></a>12.2.46.&nbsp;expand_keywords</h3></div></div></div>
  10335. <p>
  10336. Expand keywords with exact forms and/or stars when possible.
  10337. Optional, default is 0 (do not expand keywords).
  10338. Introduced in version 1.10-beta.
  10339. </p><p>
  10340. Queries against indexes with <code class="option">expand_keywords</code> feature
  10341. enabled are internally expanded as follows. If the index was built with
  10342. prefix or infix indexing enabled, every keyword gets internally replaced
  10343. with a disjunction of keyword itself and a respective prefix or infix
  10344. (keyword with stars). If the index was built with both stemming and
  10345. <a class="link" href="#conf-index-exact-words" title="12.2.42.&nbsp;index_exact_words">index_exact_words</a> enabled,
  10346. exact form is also added. Here's an example that shows how internal
  10347. expansion works when all of the above (infixes, stemming, and exact
  10348. words) are combined:
  10349. </p><pre class="programlisting">
  10350. running -&gt; ( running | *running* | =running )
  10351. </pre><p>
  10352. </p><p>
  10353. Expanded queries take naturally longer to complete, but can possibly
  10354. improve the search quality, as the documents with exact form matches
  10355. should be ranked generally higher than documents with stemmed or infix matches.
  10356. </p><p>
  10357. Note that the existing query syntax does not allow to emulate this
  10358. kind of expansion, because internal expansion works on keyword level and
  10359. expands keywords within phrase or quorum operators too (which is not
  10360. possible through the query syntax).
  10361. </p><p>
  10362. This directive does not affect <code class="filename">indexer</code> in any way,
  10363. it only affects <code class="filename">searchd</code>.
  10364. </p><h4><a name="idp33717232"></a>Example:</h4><pre class="programlisting">
  10365. expand_keywords = 1
  10366. </pre></div>
  10367. <div class="sect2" title="12.2.47.&nbsp;blend_chars"><div class="titlepage"><div><div><h3 class="title"><a name="conf-blend-chars"></a>12.2.47.&nbsp;blend_chars</h3></div></div></div>
  10368. <p>
  10369. Blended characters list.
  10370. Optional, default is empty.
  10371. Introduced in version 1.10-beta.
  10372. </p><p>
  10373. Blended characters are indexed both as separators and valid characters.
  10374. For instance, assume that &amp; is configured as blended and AT&amp;T
  10375. occurs in an indexed document. Three different keywords will get indexed,
  10376. namely "at&amp;t", treating blended characters as valid, plus "at" and "t",
  10377. treating them as separators.
  10378. </p><p>
  10379. Positions for tokens obtained by replacing blended characters with whitespace
  10380. are assigned as usual, so regular keywords will be indexed just as if there was
  10381. no <code class="option">blend_chars</code> specified at all. An additional token that
  10382. mixes blended and non-blended characters will be put at the starting position.
  10383. For instance, if the field contents are "AT&amp;T company" occurs in the very
  10384. beginning of the text field, "at" will be given position 1, "t" position 2,
  10385. "company" position 3, and "AT&amp;T" will also be given position 1 ("blending"
  10386. with the opening regular keyword). Thus, querying for either AT&amp;T or just
  10387. AT will match that document, and querying for "AT T" as a phrase also match it.
  10388. Last but not least, phrase query for "AT&amp;T company" will <span class="emphasis"><em>also</em></span>
  10389. match it, despite the position
  10390. </p><p>
  10391. Blended characters can overlap with special characters used in query
  10392. syntax (think of T-Mobile or @twitter). Where possible, query parser will
  10393. automatically handle blended character as blended. For instance, "hello @twitter"
  10394. within quotes (a phrase operator) would handle @-sign as blended, because
  10395. @-syntax for field operator is not allowed within phrases. Otherwise,
  10396. the character would be handled as an operator. So you might want to
  10397. escape the keywords.
  10398. </p><p>
  10399. Starting with version 2.0.1-beta, blended characters can be remapped,
  10400. so that multiple different blended characters could be normalized into
  10401. just one base form. This is useful when indexing multiple alternative
  10402. Unicode codepoints with equivalent glyphs.
  10403. </p><h4><a name="idp33724752"></a>Example:</h4><pre class="programlisting">
  10404. blend_chars = +, &amp;, U+23
  10405. blend_chars = +, &amp;-&gt;+ # 2.0.1 and above
  10406. </pre></div>
  10407. <div class="sect2" title="12.2.48.&nbsp;blend_mode"><div class="titlepage"><div><div><h3 class="title"><a name="conf-blend-mode"></a>12.2.48.&nbsp;blend_mode</h3></div></div></div>
  10408. <p>
  10409. Blended tokens indexing mode.
  10410. Optional, default is <code class="option">trim_none</code>.
  10411. Introduced in version 2.0.1-beta.
  10412. </p><p>
  10413. By default, tokens that mix blended and non-blended characters
  10414. get indexed in there entirety. For instance, when both at-sign and
  10415. an exclamation are in <code class="option">blend_chars</code>, "@dude!" will get
  10416. result in two tokens indexed: "@dude!" (with all the blended characters)
  10417. and "dude" (without any). Therefore "@dude" query will <span class="emphasis"><em>not</em></span>
  10418. match it.
  10419. </p><p>
  10420. <code class="option">blend_mode</code> directive adds flexibility to this indexing
  10421. behavior. It takes a comma-separated list of options.
  10422. </p><pre class="programlisting">
  10423. blend_mode = option [, option [, ...]]
  10424. option = trim_none | trim_head | trim_tail | trim_both | skip_pure
  10425. </pre><p>
  10426. </p><p>
  10427. Options specify token indexing variants. If multiple options are
  10428. specified, multiple variants of the same token will be indexed.
  10429. Regular keywords (resulting from that token by replacing blended
  10430. with whitespace) are always be indexed.
  10431. </p><div class="variablelist"><dl><dt><span class="term">trim_none</span></dt>
  10432. <dd><p>Index the entire token.</p></dd><dt><span class="term">trim_head</span></dt>
  10433. <dd><p>Trim heading blended characters, and index the resulting token.</p></dd><dt><span class="term">trim_tail</span></dt>
  10434. <dd><p>Trim trailing blended characters, and index the resulting token.</p></dd><dt><span class="term">trim_both</span></dt>
  10435. <dd><p>Trim both heading and trailing blended characters, and index the resulting token.</p></dd><dt><span class="term">skip_pure</span></dt>
  10436. <dd><p>Do not index the token if it's purely blended, that is, consists of blended characters only.</p></dd></dl></div>
  10437. <p>
  10438. Returning to the "@dude!" example above, setting <code class="option">blend_mode = trim_head,
  10439. trim_tail</code> will result in two tokens being indexed, "@dude" and "dude!".
  10440. In this particular example, <code class="option">trim_both</code> would have no effect,
  10441. because trimming both blended characters results in "dude" which is already
  10442. indexed as a regular keyword. Indexing "@U.S.A." with <code class="option">trim_both</code>
  10443. (and assuming that dot is blended two) would result in "U.S.A" being indexed.
  10444. Last but not least, <code class="option">skip_pure</code> enables you to fully ignore
  10445. sequences of blended characters only. For example, "one @@@ two" would be
  10446. indexed exactly as "one two", and match that as a phrase. That is not the case
  10447. by default because a fully blended token gets indexed and offsets the second
  10448. keyword position.
  10449. </p><p>
  10450. Default behavior is to index the entire token, equivalent to
  10451. <code class="option">blend_mode = trim_none</code>.
  10452. </p><h4><a name="idp33742464"></a>Example:</h4><pre class="programlisting">
  10453. blend_mode = trim_tail, skip_pure
  10454. </pre></div>
  10455. <div class="sect2" title="12.2.49.&nbsp;rt_mem_limit"><div class="titlepage"><div><div><h3 class="title"><a name="conf-rt-mem-limit"></a>12.2.49.&nbsp;rt_mem_limit</h3></div></div></div>
  10456. <p>
  10457. RAM chunk size limit.
  10458. Optional, default is 128M.
  10459. Introduced in version 1.10-beta.
  10460. </p><p>
  10461. RT index keeps some data in memory (so-called RAM chunk) and
  10462. also maintains a number of on-disk indexes (so-called disk chunks).
  10463. This directive lets you control the RAM chunk size. Once there's
  10464. too much data to keep in RAM, RT index will flush it to disk,
  10465. activate a newly created disk chunk, and reset the RAM chunk.
  10466. </p><p>
  10467. The limit is pretty strict; RT index should never allocate more
  10468. memory than it's limited to. The memory is not preallocated either,
  10469. hence, specifying 512 MB limit and only inserting 3 MB of data
  10470. should result in allocating 3 MB, not 512 MB.
  10471. </p><p>
  10472. </p><h4><a name="idp33746912"></a>Example:</h4><pre class="programlisting">
  10473. rt_mem_limit = 512M
  10474. </pre></div>
  10475. <div class="sect2" title="12.2.50.&nbsp;rt_field"><div class="titlepage"><div><div><h3 class="title"><a name="conf-rt-field"></a>12.2.50.&nbsp;rt_field</h3></div></div></div>
  10476. <p>
  10477. Full-text field declaration.
  10478. Multi-value, mandatory
  10479. Introduced in version 1.10-beta.
  10480. </p><p>
  10481. Full-text fields to be indexed are declared using <code class="option">rt_field</code>
  10482. directive. The names must be unique. The order is preserved; and so field values
  10483. in INSERT statements without an explicit list of inserted columns will have to be
  10484. in the same order as configured.
  10485. </p><p>
  10486. </p><h4><a name="idp33751104"></a>Example:</h4><pre class="programlisting">
  10487. rt_field = author
  10488. rt_field = title
  10489. rt_field = content
  10490. </pre></div>
  10491. <div class="sect2" title="12.2.51.&nbsp;rt_attr_uint"><div class="titlepage"><div><div><h3 class="title"><a name="conf-rt-attr-uint"></a>12.2.51.&nbsp;rt_attr_uint</h3></div></div></div>
  10492. <p>
  10493. Unsigned integer attribute declaration.
  10494. Multi-value (an arbitrary number of attributes is allowed), optional.
  10495. Declares an unsigned 32-bit attribute.
  10496. Introduced in version 1.10-beta.
  10497. </p><h4><a name="idp33753920"></a>Example:</h4><pre class="programlisting">
  10498. rt_attr_uint = gid
  10499. </pre></div>
  10500. <div class="sect2" title="12.2.52.&nbsp;rt_attr_bool"><div class="titlepage"><div><div><h3 class="title"><a name="conf-rt-attr-bool"></a>12.2.52.&nbsp;rt_attr_bool</h3></div></div></div>
  10501. <p>
  10502. Boolean attribute declaration.
  10503. Multi-value (there might be multiple attributes declared), optional.
  10504. Declares a 1-bit unsigned integer attribute.
  10505. Introduced in version 2.1.2-release.
  10506. </p><h4><a name="idp33756752"></a>Example:</h4><pre class="programlisting">
  10507. rt_attr_bool = available
  10508. </pre></div>
  10509. <div class="sect2" title="12.2.53.&nbsp;rt_attr_bigint"><div class="titlepage"><div><div><h3 class="title"><a name="conf-rt-attr-bigint"></a>12.2.53.&nbsp;rt_attr_bigint</h3></div></div></div>
  10510. <p>
  10511. BIGINT attribute declaration.
  10512. Multi-value (an arbitrary number of attributes is allowed), optional.
  10513. Declares a signed 64-bit attribute.
  10514. Introduced in version 1.10-beta.
  10515. </p><h4><a name="idp33759600"></a>Example:</h4><pre class="programlisting">
  10516. rt_attr_bigint = guid
  10517. </pre></div>
  10518. <div class="sect2" title="12.2.54.&nbsp;rt_attr_float"><div class="titlepage"><div><div><h3 class="title"><a name="conf-rt-attr-float"></a>12.2.54.&nbsp;rt_attr_float</h3></div></div></div>
  10519. <p>
  10520. Floating point attribute declaration.
  10521. Multi-value (an arbitrary number of attributes is allowed), optional.
  10522. Declares a single precision, 32-bit IEEE 754 format float attribute.
  10523. Introduced in version 1.10-beta.
  10524. </p><h4><a name="idp33762400"></a>Example:</h4><pre class="programlisting">
  10525. rt_attr_float = gpa
  10526. </pre></div>
  10527. <div class="sect2" title="12.2.55.&nbsp;rt_attr_multi"><div class="titlepage"><div><div><h3 class="title"><a name="conf-rt-attr-multi"></a>12.2.55.&nbsp;rt_attr_multi</h3></div></div></div>
  10528. <p>
  10529. <a class="link" href="#mva" title="3.4.&nbsp;MVA (multi-valued attributes)">Multi-valued attribute</a> (MVA) declaration.
  10530. Declares the UNSIGNED INTEGER (unsigned 32-bit) MVA attribute.
  10531. Multi-value (ie. there may be more than one such attribute declared), optional.
  10532. Applies to RT indexes only.
  10533. </p><h4><a name="idp33766016"></a>Example:</h4><pre class="programlisting">
  10534. rt_attr_multi = my_tags
  10535. </pre></div>
  10536. <div class="sect2" title="12.2.56.&nbsp;rt_attr_multi_64"><div class="titlepage"><div><div><h3 class="title"><a name="conf-rt-attr-multi-64"></a>12.2.56.&nbsp;rt_attr_multi_64</h3></div></div></div>
  10537. <p>
  10538. <a class="link" href="#mva" title="3.4.&nbsp;MVA (multi-valued attributes)">Multi-valued attribute</a> (MVA) declaration.
  10539. Declares the BIGINT (signed 64-bit) MVA attribute.
  10540. Multi-value (ie. there may be more than one such attribute declared), optional.
  10541. Applies to RT indexes only.
  10542. </p><h4><a name="idp33769520"></a>Example:</h4><pre class="programlisting">
  10543. rt_attr_multi_64 = my_wide_tags
  10544. </pre></div>
  10545. <div class="sect2" title="12.2.57.&nbsp;rt_attr_timestamp"><div class="titlepage"><div><div><h3 class="title"><a name="conf-rt-attr-timestamp"></a>12.2.57.&nbsp;rt_attr_timestamp</h3></div></div></div>
  10546. <p>
  10547. Timestamp attribute declaration.
  10548. Multi-value (an arbitrary number of attributes is allowed), optional.
  10549. Introduced in version 1.10-beta.
  10550. </p><h4><a name="idp33772272"></a>Example:</h4><pre class="programlisting">
  10551. rt_attr_timestamp = date_added
  10552. </pre></div>
  10553. <div class="sect2" title="12.2.58.&nbsp;rt_attr_string"><div class="titlepage"><div><div><h3 class="title"><a name="conf-rt-attr-string"></a>12.2.58.&nbsp;rt_attr_string</h3></div></div></div>
  10554. <p>
  10555. String attribute declaration.
  10556. Multi-value (an arbitrary number of attributes is allowed), optional.
  10557. Introduced in version 1.10-beta.
  10558. </p><h4><a name="idp33775024"></a>Example:</h4><pre class="programlisting">
  10559. rt_attr_string = author
  10560. </pre></div>
  10561. <div class="sect2" title="12.2.59.&nbsp;rt_attr_json"><div class="titlepage"><div><div><h3 class="title"><a name="conf-rt-attr-json"></a>12.2.59.&nbsp;rt_attr_json</h3></div></div></div>
  10562. <p>
  10563. JSON attribute declaration.
  10564. Multi-value (ie. there may be more than one such attribute declared), optional.
  10565. Introduced in version 2.1.1-beta.
  10566. </p><p>
  10567. Refer to <a class="xref" href="#conf-sql-attr-json" title="12.1.24.&nbsp;sql_attr_json">Section&nbsp;12.1.24, &#8220;sql_attr_json&#8221;</a> for more details on the JSON attributes.
  10568. </p><h4><a name="idp33778992"></a>Example:</h4><pre class="programlisting">
  10569. rt_attr_json = properties
  10570. </pre></div>
  10571. <div class="sect2" title="12.2.60.&nbsp;ha_strategy"><div class="titlepage"><div><div><h3 class="title"><a name="conf-ha-strategy"></a>12.2.60.&nbsp;ha_strategy</h3></div></div></div>
  10572. <p>
  10573. Agent mirror selection strategy, for load balancing.
  10574. Optional, default is random.
  10575. Added in 2.1.1-beta.
  10576. </p><p>
  10577. The strategy used for mirror selection, or in other words, choosing
  10578. a specific <a class="link" href="#conf-agent" title="12.2.31.&nbsp;agent">agent mirror</a> in a distributed
  10579. index. Essentially, this directive controls how exactly master does the
  10580. load balancing between the configured mirror agent nodes.
  10581. As of 2.1.1-beta, the following strategies are implemented:
  10582. </p><h4><a name="idp33783200"></a>Simple random balancing</h4><pre class="programlisting">ha_strategy = random</pre><p>
  10583. The default balancing mode. Simple linear random distribution among the mirrors.
  10584. That is, equal selection probability are assigned to every mirror. Kind of similar
  10585. to round-robin (RR), but unlike RR, does not impose a strict selection order.
  10586. </p><h4><a name="idp33784944"></a>Adaptive randomized balancing</h4><p>
  10587. The default simple random strategy does not take mirror status, error rate,
  10588. and, most importantly, actual response latencies into account. So to accommodate
  10589. for heterogeneous clusters and/or temporary spikes in agent node load, we have
  10590. a group of balancing strategies that dynamically adjusts the probabilities
  10591. based on the actual query latencies observed by the master.
  10592. </p><p>
  10593. The adaptive strategies based on <span class="bold"><strong>latency-weighted probabilities</strong></span>
  10594. basically work as follows:
  10595. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>latency stats are accumulated, in blocks of ha_period_karma seconds;</p></li>
  10596. <li class="listitem"><p>once per karma period, latency-weighted probabilities get recomputed;</p></li>
  10597. <li class="listitem"><p>once per request (including ping requests), "dead or alive" flag is adjusted.</p></li>
  10598. </ul></div>
  10599. <p>
  10600. Currently (as of 2.1.1-beta), we begin with equal probabilities (or percentages,
  10601. for brevity), and on every step, scale them by the inverse of the latencies observed
  10602. during the last "karma" period, and then renormalize them. For example, if during
  10603. the first 60 seconds after the master startup 4 mirrors had latencies of
  10604. 10, 5, 30, and 3 msec/query respectively, the first adjustment step
  10605. would go as follow:
  10606. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>initial percentages: 0.25, 0.25, 0.25, 0.2%;</p></li>
  10607. <li class="listitem"><p>observed latencies: 10 ms, 5 ms, 30 ms, 3 ms;</p></li>
  10608. <li class="listitem"><p>inverse latencies: 0.1, 0.2, 0.0333, 0.333;</p></li>
  10609. <li class="listitem"><p>scaled percentages: 0.025, 0.05, 0.008333, 0.0833;</p></li>
  10610. <li class="listitem"><p>renormalized percentages: 0.15, 0.30, 0.05, 0.50.</p></li>
  10611. </ul></div>
  10612. <p>
  10613. Meaning that the 1st mirror would have a 15% chance of being chosen during
  10614. the next karma period, the 2nd one a 30% chance, the 3rd one (slowest at 30 ms)
  10615. only a 5% chance, and the 4th and the fastest one (at 3 ms) a 50% chance.
  10616. Then, after that period, the second adjustment step would update those chances
  10617. again, and so on.
  10618. </p><p>
  10619. The rationale here is, once the <span class="bold"><strong>observed latencies</strong></span> stabilize,
  10620. the <span class="bold"><strong>latency weighted probabilities</strong></span> stabilize as well. So all these
  10621. adjustment iterations are supposed to converge at a point where the average
  10622. latencies are (roughly) equal over all mirrors.
  10623. </p><pre class="programlisting">ha_strategy = nodeads</pre><p>
  10624. Latency-weighted probabilities, but dead mirrors are excluded from
  10625. the selection. "Dead" mirror is defined as a mirror that resulted
  10626. in multiple hard errors (eg. network failure, or no answer, etc) in a row.
  10627. </p><pre class="programlisting">ha_strategy = noerrors</pre><p>
  10628. Latency-weighted probabilities, but mirrors with worse errors/success ratio
  10629. are excluded from the selection.
  10630. </p><h4><a name="idp33798064"></a>Round-robin balancing</h4><pre class="programlisting">ha_strategy = roundrobin</pre><p>Simple round-robin selection, that is, selecting the 1st mirror
  10631. in the list, then the 2nd one, then the 3rd one, etc, and then repeating
  10632. the process once the last mirror in the list is reached. Unlike with
  10633. the randomized strategies, RR imposes a strict querying order (1, 2, 3, ..,
  10634. N-1, N, 1, 2, 3, ... and so on) and <span class="emphasis"><em>guarantees</em></span> that
  10635. no two subsequent queries will be sent to the same mirror.
  10636. </p></div>
  10637. <div class="sect2" title="12.2.61.&nbsp;bigram_freq_words"><div class="titlepage"><div><div><h3 class="title"><a name="conf-bigram-freq-words"></a>12.2.61.&nbsp;bigram_freq_words</h3></div></div></div>
  10638. <p>
  10639. A list of keywords considered "frequent" when indexing bigrams.
  10640. Optional, default is empty.
  10641. Added in 2.1.1-beta.
  10642. </p><p>
  10643. Bigram indexing is a feature to accelerate phrase searches.
  10644. When indexing, it stores a document list for either all or some
  10645. of the adjacent words pairs into the index. Such a list can then be used
  10646. at searching time to significantly accelerate phrase or sub-phrase
  10647. matching.
  10648. </p><p>
  10649. Some of the bigram indexing modes (see <a class="xref" href="#conf-bigram-index" title="12.2.62.&nbsp;bigram_index">Section&nbsp;12.2.62, &#8220;bigram_index&#8221;</a>)
  10650. require to define a list of frequent keywords. These are <span class="bold"><strong>not</strong></span> to be
  10651. confused with stopwords! Stopwords are completely eliminated when both indexing
  10652. and searching. Frequent keywords are only used by bigrams to determine whether
  10653. to index a current word pair or not.
  10654. </p><p>
  10655. <code class="code">bigram_freq_words</code> lets you define a list of such keywords.
  10656. </p><h4><a name="idp33805712"></a>Example:</h4><pre class="programlisting">
  10657. bigram_freq_words = the, a, you, i
  10658. </pre></div>
  10659. <div class="sect2" title="12.2.62.&nbsp;bigram_index"><div class="titlepage"><div><div><h3 class="title"><a name="conf-bigram-index"></a>12.2.62.&nbsp;bigram_index</h3></div></div></div>
  10660. <p>
  10661. Bigram indexing mode.
  10662. Optional, default is none.
  10663. Added in 2.1.1-beta.
  10664. </p><p>
  10665. Bigram indexing is a feature to accelerate phrase searches.
  10666. When indexing, it stores a document list for either all or some
  10667. of the adjacent words pairs into the index. Such a list can then be used
  10668. at searching time to significantly accelerate phrase or sub-phrase
  10669. matching.
  10670. </p><p>
  10671. <code class="code">bigram_index</code> controls the selection of specific word pairs.
  10672. The known modes are:
  10673. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="code">all</code>, index every single word pair.
  10674. (NB: probably totally not worth it even on a moderately sized index,
  10675. but added anyway for the sake of completeness.)
  10676. </p></li>
  10677. <li class="listitem"><p><code class="code">first_freq</code>, only index word pairs
  10678. where the <span class="emphasis"><em>first</em></span> word is in a list of frequent words
  10679. (see <a class="xref" href="#conf-bigram-freq-words" title="12.2.61.&nbsp;bigram_freq_words">Section&nbsp;12.2.61, &#8220;bigram_freq_words&#8221;</a>). For example, with
  10680. <code class="code">bigram_freq_words = the, in, i, a</code>, indexing
  10681. "alone in the dark" text will result in "in the" and "the dark" pairs
  10682. being stored as bigrams, because they begin with a frequent keyword
  10683. (either "in" or "the" respectively), but "alone in" would <span class="bold"><strong>not</strong></span>
  10684. be indexed, because "in" is a <span class="emphasis"><em>second</em></span> word in that pair.
  10685. </p></li>
  10686. <li class="listitem"><p><code class="code">both_freq</code>, only index word pairs where
  10687. both words are frequent. Continuing with the same example, in this mode
  10688. indexing "alone in the dark" would only store "in the" (the very worst
  10689. of them all from searching perspective) as a bigram, but none of the
  10690. other word pairs.
  10691. </p></li>
  10692. </ul></div>
  10693. <p>
  10694. For most usecases, <code class="code">both_freq</code> would be the best mode, but
  10695. your mileage may vary.
  10696. </p><h4><a name="idp33816784"></a>Example:</h4><pre class="programlisting">
  10697. bigram_freq_words = both_freq
  10698. </pre></div>
  10699. <div class="sect2" title="12.2.63.&nbsp;index_field_lengths"><div class="titlepage"><div><div><h3 class="title"><a name="conf-index-field-lengths"></a>12.2.63.&nbsp;index_field_lengths</h3></div></div></div>
  10700. <p>
  10701. Enables computing and storing of field lengths (both per-document and
  10702. average per-index values) into the index.
  10703. Optional, default is 0 (do not compute and store).
  10704. Added in 2.1.1-beta.
  10705. </p><p>
  10706. When <code class="code">index_field_lengths</code> is set to 1, <code class="filename">indexer</code>
  10707. will 1) create a respective length attribute for every full-text field,
  10708. sharing the same name; 2) compute a field length (counted in keywords) for
  10709. every document and store in to a respective attribute; 3) compute the per-index
  10710. averages. The lengths attributes will have a special TOKENCOUNT type, but their
  10711. values are in fact regular 32-bit integers, and their values are generally
  10712. accessible.
  10713. </p><p>
  10714. BM25A() and BM25F() functions in the expression ranker are based
  10715. on these lengths and require <code class="code">index_field_lengths</code> to be enabled.
  10716. Historically, Sphinx used a simplified, stripped-down variant of BM25 that,
  10717. unlike the complete function, did <span class="bold"><strong>not</strong></span> account for document length.
  10718. (We later realized that it should have been called BM15 from the start.)
  10719. Starting with 2.1.1-beta, we added support for both a complete variant of BM25,
  10720. and its extension towards multiple fields, called BM25F. They require
  10721. per-document length and per-field lengths, respectively. Hence the additional
  10722. directive.
  10723. </p><h4><a name="idp33823712"></a>Example:</h4><pre class="programlisting">
  10724. index_field_lengths = 1
  10725. </pre></div>
  10726. <div class="sect2" title="12.2.64.&nbsp;regexp_filter"><div class="titlepage"><div><div><h3 class="title"><a name="conf-regexp-filter"></a>12.2.64.&nbsp;regexp_filter</h3></div></div></div>
  10727. <p>
  10728. Regular expressions (regexps) to filter the fields and queries with.
  10729. Optional, multi-value, default is an empty list of regexps.
  10730. Added in 2.1.1-beta.
  10731. </p><p>
  10732. In certain applications (like product search) there can be
  10733. many different ways to call a model, or a product, or a property,
  10734. and so on. For instance, 'iphone 3gs' and 'iphone 3 gs'
  10735. (or even 'iphone3 gs') are very likely to mean the same
  10736. product. Or, for a more tricky example, '13-inch', '13 inch',
  10737. '13"', and '13in' in a laptop screen size descriptions do mean
  10738. the same.
  10739. </p><p>
  10740. Regexps provide you with a mechanism to specify a number of rules
  10741. specific to your application to handle such cases. In the first
  10742. 'iphone 3gs' example, you could possibly get away with a wordforms
  10743. files tailored to handle a handful of iPhone models. However even
  10744. in a comparatively simple second '13-inch' example there is just
  10745. way too many individual forms and you are better off specifying
  10746. rules that would normalize both '13-inch' and '13in' to something
  10747. identical.
  10748. </p><p>
  10749. Regular expressions listed in <code class="code">regexp_filter</code> are
  10750. applied in the order they are listed. That happens at the earliest
  10751. stage possible, before any other processing, even before tokenization.
  10752. That is, regexps are applied to the raw source fields when indeixng,
  10753. and to the raw search query text when searching.
  10754. </p><p>
  10755. We use the <a class="ulink" href="http://code.google.com/p/re2/" target="_top">RE2 engine</a>
  10756. to implement regexps. So when building from the source, the library must be
  10757. installed in the system and Sphinx must be configured built with a
  10758. <code class="code">--with-re2</code> switch. Binary packages should come with RE2
  10759. builtin.
  10760. </p><h4><a name="idp33830880"></a>Example:</h4><pre class="programlisting">
  10761. # index '13-inch' as '13inch'
  10762. regexp_filter = \b(\d+)\" =&gt; \1inch
  10763. # index 'blue' or 'red' as 'color'
  10764. regexp_filter = (blue|red) =&gt; color
  10765. </pre></div>
  10766. <div class="sect2" title="12.2.65.&nbsp;stopwords_unstemmed"><div class="titlepage"><div><div><h3 class="title"><a name="conf-stopwords-unstemmed"></a>12.2.65.&nbsp;stopwords_unstemmed</h3></div></div></div>
  10767. <p>
  10768. Whether to apply stopwords before or after stemming.
  10769. Optional, default is 0 (apply stopword filter after stemming).
  10770. Added in 2.1.1-beta.
  10771. </p><p>
  10772. By default, stopwords are stemmed themselves, and applied to
  10773. tokens <span class="emphasis"><em>after</em></span> stemming (or any other morphology
  10774. processing). In other words, by default, a token is stopped when
  10775. stem(token) == stem(stopword). That can lead to unexpected results
  10776. when a token gets (erroneously) stemmed to a stopped root. For example,
  10777. 'Andes' gets stemmed to 'and' by our current stemmer implementation,
  10778. so when 'and' is a stopword, 'Andes' is also stopped.
  10779. </p><p>
  10780. stopwords_unstemmed directive fixes that issue. When it's enabled,
  10781. stopwords are applied before stemming (and therefore to the original
  10782. word forms), and the tokens are stopped when token == stopword.
  10783. </p><h4><a name="idp33835712"></a>Example:</h4><pre class="programlisting">
  10784. stopwords_unstemmed = 1
  10785. </pre></div>
  10786. <div class="sect2" title="12.2.66.&nbsp;global_idf"><div class="titlepage"><div><div><h3 class="title"><a name="conf-global-idf"></a>12.2.66.&nbsp;global_idf</h3></div></div></div>
  10787. <p>
  10788. The path to a file with global (cluster-wide) keyword IDFs.
  10789. Optional, default is empty (use local IDFs).
  10790. Added in 2.1.1-beta.
  10791. </p><p>
  10792. On a multi-index cluster, per-keyword frequencies are quite
  10793. likely to differ across different indexes. That means that when
  10794. the ranking function uses TF-IDF based values, such as BM25 family
  10795. of factors, the results might be ranked slightly different
  10796. depending on what cluster node they reside.
  10797. </p><p>
  10798. The easiest way to fix that issue is to create and utilize
  10799. a global frequency dictionary, or a global IDF file for short.
  10800. This directive lets you specify the location of that file.
  10801. It it suggested (but not required) to use a .idf extension.
  10802. When the IDF file is specified for a given index <span class="emphasis"><em>and</em></span>
  10803. and OPTION global_idf is set to 1, the engine will use the keyword
  10804. frequencies and collection documents count from the global_idf file,
  10805. rather than just the local index. That way, IDFs and the values
  10806. that depend on them will stay consistent across the cluster.
  10807. </p><p>
  10808. IDF files can be shared across multiple indexes. Only a single
  10809. copy of an IDF file will be loaded by <code class="filename">searchd</code>,
  10810. even when many indexes refer to that file. Should the contents of
  10811. an IDF file change, the new contents can be loaded with a SIGHUP.
  10812. </p><p>
  10813. You can build an .idf file using <code class="filename">indextool</code>
  10814. utility, by dumping dictionaries using <code class="code">--dumpdict</code> switch
  10815. first, then converting those to .idf format using <code class="code">--buildidf</code>,
  10816. then merging all .idf files across cluser using <code class="code">--mergeidf</code>.
  10817. Refer to <a class="xref" href="#ref-indextool" title="7.4.&nbsp;indextool command reference">Section&nbsp;7.4, &#8220;<code class="filename">indextool</code> command reference&#8221;</a> for more information.
  10818. </p><h4><a name="idp33845056"></a>Example:</h4><pre class="programlisting">
  10819. global_idf = /usr/local/sphinx/var/global.idf
  10820. </pre></div>
  10821. <div class="sect2" title="12.2.67.&nbsp;rlp_context"><div class="titlepage"><div><div><h3 class="title"><a name="conf-rlp-context"></a>12.2.67.&nbsp;rlp_context</h3></div></div></div>
  10822. <p>
  10823. RLP context configuration file. Mandatory if RLP is used.
  10824. Added in 2.2.1-beta.
  10825. </p><h4><a name="idp33847776"></a>Example:</h4><pre class="programlisting">
  10826. rlp_context = /home/myuser/RLP/rlp-context.xml
  10827. </pre></div>
  10828. <div class="sect2" title="12.2.68.&nbsp;ondisk_attrs"><div class="titlepage"><div><div><h3 class="title"><a name="conf-ondisk-attrs"></a>12.2.68.&nbsp;ondisk_attrs</h3></div></div></div>
  10829. <p>
  10830. Allows for fine-grain control over how attributes are loaded into memory
  10831. when using indexes with external storage. It is now possible (since
  10832. version 2.2.1-beta) to keep attributes on disk. Although, the daemon does
  10833. map them to memory and the OS loads small chunks of data on demand. This
  10834. allows use of docinfo = extern instead of docinfo = inline, but still
  10835. leaves plenty of free memory for cases when you have large collections
  10836. of pooled attributes (string/JSON/MVA) or when you're using many indexes
  10837. per daemon that don't consume memory. It is not possible to update
  10838. attributes left on disk when this option is enabled and the constraint
  10839. of 4Gb of entries per pool is still in effect.
  10840. </p><p>
  10841. Note that this option also affects RT indexes. When it is enabled, all atribute updates
  10842. will be disabled, and also all disk chunks of RT indexes will behave described above. However
  10843. inserting and deleting of docs from RT indexes is still possible with enabled ondisk_attrs.
  10844. </p><h4><a name="idp33851776"></a>Possible values:</h4><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
  10845. 0 - disabled and default value, all attributes are loaded in memory
  10846. (the normal behaviour of docinfo = extern)
  10847. </li>
  10848. <li class="listitem">
  10849. 1 - all attributes stay on disk. Daemon loads no files (spa, spm, sps).
  10850. This is the most memory conserving mode, however it is also the slowest
  10851. as the whole doc-id-list and block index doesn't load.
  10852. </li>
  10853. <li class="listitem">
  10854. pool - only pooled attributes stay on disk. Pooled attributes are string,
  10855. MVA, and JSON attributes (sps, spm files). Scalar attributes stored in
  10856. docinfo (spa file) load as usual.
  10857. </li>
  10858. </ul></div>
  10859. <p>
  10860. This option does not affect indexing in any way, it only requires daemon
  10861. restart.
  10862. </p><h4><a name="idp33854752"></a>Example:</h4><pre class="programlisting">
  10863. ondisk_attrs = pool #keep pooled attributes on disk
  10864. </pre></div></div>
  10865. <div class="sect1" title="12.3.&nbsp;indexer program configuration options"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="confgroup-indexer"></a>12.3.&nbsp;<code class="filename">indexer</code> program configuration options</h2></div></div></div>
  10866. <div class="sect2" title="12.3.1.&nbsp;mem_limit"><div class="titlepage"><div><div><h3 class="title"><a name="conf-mem-limit"></a>12.3.1.&nbsp;mem_limit</h3></div></div></div>
  10867. <p>
  10868. Indexing RAM usage limit.
  10869. Optional, default is 128M.
  10870. </p><p>
  10871. Enforced memory usage limit that the <code class="filename">indexer</code>
  10872. will not go above. Can be specified in bytes, or kilobytes
  10873. (using K postfix), or megabytes (using M postfix); see the example.
  10874. This limit will be automatically raised if set to extremely low value
  10875. causing I/O buffers to be less than 8 KB; the exact lower bound
  10876. for that depends on the indexed data size. If the buffers are
  10877. less than 256 KB, a warning will be produced.
  10878. </p><p>
  10879. Maximum possible limit is 2047M. Too low values can hurt
  10880. indexing speed, but 256M to 1024M should be enough for most
  10881. if not all datasets. Setting this value too high can cause
  10882. SQL server timeouts. During the document collection phase,
  10883. there will be periods when the memory buffer is partially
  10884. sorted and no communication with the database is performed;
  10885. and the database server can timeout. You can resolve that
  10886. either by raising timeouts on SQL server side or by lowering
  10887. <code class="code">mem_limit</code>.
  10888. </p><h4><a name="idp33861968"></a>Example:</h4><pre class="programlisting">
  10889. mem_limit = 256M
  10890. # mem_limit = 262144K # same, but in KB
  10891. # mem_limit = 268435456 # same, but in bytes
  10892. </pre></div>
  10893. <div class="sect2" title="12.3.2.&nbsp;max_iops"><div class="titlepage"><div><div><h3 class="title"><a name="conf-max-iops"></a>12.3.2.&nbsp;max_iops</h3></div></div></div>
  10894. <p>
  10895. Maximum I/O operations per second, for I/O throttling.
  10896. Optional, default is 0 (unlimited).
  10897. </p><p>
  10898. I/O throttling related option.
  10899. It limits maximum count of I/O operations (reads or writes) per any given second.
  10900. A value of 0 means that no limit is imposed.
  10901. </p><p>
  10902. <code class="filename">indexer</code> can cause bursts of intensive disk I/O during
  10903. indexing, and it might desired to limit its disk activity (and keep something
  10904. for other programs running on the same machine, such as <code class="filename">searchd</code>).
  10905. I/O throttling helps to do that. It works by enforcing a minimum guaranteed
  10906. delay between subsequent disk I/O operations performed by <code class="filename">indexer</code>.
  10907. Modern SATA HDDs are able to perform up to 70-100+ I/O operations per second
  10908. (that's mostly limited by disk heads seek time). Limiting indexing I/O
  10909. to a fraction of that can help reduce search performance degradation
  10910. caused by indexing.
  10911. </p><h4><a name="idp33868416"></a>Example:</h4><pre class="programlisting">
  10912. max_iops = 40
  10913. </pre></div>
  10914. <div class="sect2" title="12.3.3.&nbsp;max_iosize"><div class="titlepage"><div><div><h3 class="title"><a name="conf-max-iosize"></a>12.3.3.&nbsp;max_iosize</h3></div></div></div>
  10915. <p>
  10916. Maximum allowed I/O operation size, in bytes, for I/O throttling.
  10917. Optional, default is 0 (unlimited).
  10918. </p><p>
  10919. I/O throttling related option. It limits maximum file I/O operation
  10920. (read or write) size for all operations performed by <code class="filename">indexer</code>.
  10921. A value of 0 means that no limit is imposed.
  10922. Reads or writes that are bigger than the limit
  10923. will be split in several smaller operations, and counted as several operation
  10924. by <a class="link" href="#conf-max-iops" title="12.3.2.&nbsp;max_iops">max_iops</a> setting. At the time of this
  10925. writing, all I/O calls should be under 256 KB (default internal buffer size)
  10926. anyway, so <code class="code">max_iosize</code> values higher than 256 KB must not affect anything.
  10927. </p><h4><a name="idp33874048"></a>Example:</h4><pre class="programlisting">
  10928. max_iosize = 1048576
  10929. </pre></div>
  10930. <div class="sect2" title="12.3.4.&nbsp;max_xmlpipe2_field"><div class="titlepage"><div><div><h3 class="title"><a name="conf-max-xmlpipe2-field"></a>12.3.4.&nbsp;max_xmlpipe2_field</h3></div></div></div>
  10931. <p>
  10932. Maximum allowed field size for XMLpipe2 source type, bytes.
  10933. Optional, default is 2 MB.
  10934. </p><h4><a name="idp33876800"></a>Example:</h4><pre class="programlisting">
  10935. max_xmlpipe2_field = 8M
  10936. </pre></div>
  10937. <div class="sect2" title="12.3.5.&nbsp;write_buffer"><div class="titlepage"><div><div><h3 class="title"><a name="conf-write-buffer"></a>12.3.5.&nbsp;write_buffer</h3></div></div></div>
  10938. <p>
  10939. Write buffer size, bytes.
  10940. Optional, default is 1 MB.
  10941. </p><p>
  10942. Write buffers are used to write both temporary and final index
  10943. files when indexing. Larger buffers reduce the number of required
  10944. disk writes. Memory for the buffers is allocated in addition to
  10945. <a class="link" href="#conf-mem-limit" title="12.3.1.&nbsp;mem_limit">mem_limit</a>. Note that several
  10946. (currently up to 4) buffers for different files will be allocated,
  10947. proportionally increasing the RAM usage.
  10948. </p><h4><a name="idp33881120"></a>Example:</h4><pre class="programlisting">
  10949. write_buffer = 4M
  10950. </pre></div>
  10951. <div class="sect2" title="12.3.6.&nbsp;max_file_field_buffer"><div class="titlepage"><div><div><h3 class="title"><a name="conf-max-file-field-buffer"></a>12.3.6.&nbsp;max_file_field_buffer</h3></div></div></div>
  10952. <p>
  10953. Maximum file field adaptive buffer size, bytes.
  10954. Optional, default is 8 MB, minimum is 1 MB.
  10955. </p><p>
  10956. File field buffer is used to load files referred to from
  10957. <a class="link" href="#conf-sql-file-field" title="12.1.27.&nbsp;sql_file_field">sql_file_field</a> columns.
  10958. This buffer is adaptive, starting at 1 MB at first allocation,
  10959. and growing in 2x steps until either file contents can be loaded,
  10960. or maximum buffer size, specified by <code class="option">max_file_field_buffer</code>
  10961. directive, is reached.
  10962. </p><p>
  10963. Thus, if there are no file fields are specified, no buffer
  10964. is allocated at all. If all files loaded during indexing are under
  10965. (for example) 2 MB in size, but <code class="option">max_file_field_buffer</code>
  10966. value is 128 MB, peak buffer usage would still be only 2 MB. However,
  10967. files over 128 MB would be entirely skipped.
  10968. </p><h4><a name="idp33886944"></a>Example:</h4><pre class="programlisting">
  10969. max_file_field_buffer = 128M
  10970. </pre></div>
  10971. <div class="sect2" title="12.3.7.&nbsp;on_file_field_error"><div class="titlepage"><div><div><h3 class="title"><a name="conf-on-file-field-error"></a>12.3.7.&nbsp;on_file_field_error</h3></div></div></div>
  10972. <p>
  10973. How to handle IO errors in file fields.
  10974. Optional, default is <code class="code">ignore_field</code>.
  10975. Introduced in version 2.0.2-beta.
  10976. </p><p>
  10977. When there is a problem indexing a file referenced by a file field
  10978. (<a class="xref" href="#conf-sql-file-field" title="12.1.27.&nbsp;sql_file_field">Section&nbsp;12.1.27, &#8220;sql_file_field&#8221;</a>), <code class="filename">indexer</code> can
  10979. either index the document, assuming empty content in this particular field,
  10980. or skip the document, or fail indexing entirely. <code class="option">on_file_field_error</code>
  10981. directive controls that behavior. The values it takes are:
  10982. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="code">ignore_field</code>, index the current document without field;</p></li>
  10983. <li class="listitem"><p><code class="code">skip_document</code>, skip the current document but continue indexing;</p></li>
  10984. <li class="listitem"><p><code class="code">fail_index</code>, fail indexing with an error message.</p></li>
  10985. </ul></div>
  10986. <p>
  10987. </p><p>
  10988. The problems that can arise are: open error, size error (file too big),
  10989. and data read error. Warning messages on any problem will be given at all times,
  10990. irregardless of the phase and the <code class="code">on_file_field_error</code> setting.
  10991. </p><p>
  10992. Note that with <code class="option">on_file_field_error = skip_document</code>
  10993. documents will only be ignored if problems are detected during
  10994. an early check phase, and <span class="bold"><strong>not</strong></span> during the actual file parsing
  10995. phase. <code class="filename">indexer</code> will open every referenced file
  10996. and check its size before doing any work, and then open it again
  10997. when doing actual parsing work. So in case a file goes away
  10998. between these two open attempts, the document will still be
  10999. indexed.
  11000. </p><h4><a name="idp33899184"></a>Example:</h4><pre class="programlisting">
  11001. on_file_field_errors = skip_document
  11002. </pre></div>
  11003. <div class="sect2" title="12.3.8.&nbsp;lemmatizer_cache"><div class="titlepage"><div><div><h3 class="title"><a name="conf-lemmatizer-cache"></a>12.3.8.&nbsp;lemmatizer_cache</h3></div></div></div>
  11004. <p>
  11005. Lemmatizer cache size.
  11006. Optional, default is 256K.
  11007. Added in version 2.1.1-beta.
  11008. </p><p>
  11009. Our lemmatizer implementation (see <a class="xref" href="#conf-morphology" title="12.2.6.&nbsp;morphology">Section&nbsp;12.2.6, &#8220;morphology&#8221;</a>
  11010. for a discussion of what lemmatizers are) uses a compressed dictionary
  11011. format that enables a space/speed tradeoff. It can either perform
  11012. lemmatization off the compressed data, using more CPU but less RAM,
  11013. or it can decompress and precache the dictionary either partially
  11014. or fully, thus using less CPU but more RAM. And the lemmatizer_cache
  11015. directive lets you control how much RAM exactly can be spent for that
  11016. uncompressed dictionary cache.
  11017. </p><p>
  11018. Currently, the only available dictionary is ru.pak, the Russian one.
  11019. The compressed dictionary is approximately 10 MB in size. Note that the
  11020. dictionary stays in memory at all times, too. The default cache size
  11021. is 256 KB. The accepted cache sizes are 0 to 2047 MB. It's safe to raise
  11022. the cache size too high; the lemmatizer will only use the needed memory.
  11023. For instance, the entire Russian dictionary decompresses to approximately
  11024. 110 MB; and thus setting lemmatizer_cache anywhere higher than that will
  11025. not affect the memory use: even when 1024 MB is allowed for the cache,
  11026. if only 110 MB is needed, it will only use those 110 MB.
  11027. </p><p>
  11028. On our benchmarks, the total indexing time with different cache
  11029. sizes was as follows:
  11030. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">9.07 sec, morphology = lemmatize_ru, lemmatizer_cache = 0</li>
  11031. <li class="listitem">8.60 sec, morphology = lemmatize_ru, lemmatizer_cache = 256K</li>
  11032. <li class="listitem">8.33 sec, morphology = lemmatize_ru, lemmatizer_cache = 8M</li>
  11033. <li class="listitem">7.95 sec, morphology = lemmatize_ru, lemmatizer_cache = 128M</li>
  11034. <li class="listitem">6.85 sec, morphology = stem_ru (baseline)</li>
  11035. </ul></div>
  11036. <p>
  11037. Your mileage may vary, but a simple rule of thumb would be to either
  11038. go with the small default 256 KB cache when pressed for memory, or spend
  11039. 128 MB extra RAM and cache the entire dictionary for maximum indexing
  11040. performance.
  11041. </p><h4><a name="idp33907904"></a>Example:</h4><pre class="programlisting">
  11042. lemmatizer_cache = 256M # cache it all
  11043. </pre></div></div>
  11044. <div class="sect1" title="12.4.&nbsp;searchd program configuration options"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="confgroup-searchd"></a>12.4.&nbsp;<code class="filename">searchd</code> program configuration options</h2></div></div></div>
  11045. <div class="sect2" title="12.4.1.&nbsp;listen"><div class="titlepage"><div><div><h3 class="title"><a name="conf-listen"></a>12.4.1.&nbsp;listen</h3></div></div></div>
  11046. <p>
  11047. This setting lets you specify IP address and port, or Unix-domain
  11048. socket path, that <code class="code">searchd</code> will listen on.
  11049. Introduced in version 0.9.9-rc1.
  11050. </p><p>
  11051. The informal grammar for <code class="code">listen</code> setting is:
  11052. </p><pre class="programlisting">
  11053. listen = ( address ":" port | port | path ) [ ":" protocol ]
  11054. </pre><p>
  11055. I.e. you can specify either an IP address (or hostname) and port
  11056. number, or just a port number, or Unix socket path. If you specify
  11057. port number but not the address, <code class="code">searchd</code> will listen on
  11058. all network interfaces. Unix path is identified by a leading slash.
  11059. </p><p>
  11060. Starting with version 0.9.9-rc2, you can also specify a protocol
  11061. handler (listener) to be used for connections on this socket.
  11062. Supported protocol values are 'sphinx' (Sphinx 0.9.x API protocol)
  11063. and 'mysql41' (MySQL protocol used since 4.1 upto at least 5.1).
  11064. More details on MySQL protocol support can be found in
  11065. <a class="xref" href="#sphinxql" title="5.10.&nbsp;MySQL protocol support and SphinxQL">Section&nbsp;5.10, &#8220;MySQL protocol support and SphinxQL&#8221;</a> section.
  11066. </p><h4><a name="idp33916512"></a>Examples:</h4><pre class="programlisting">
  11067. listen = localhost
  11068. listen = localhost:5000
  11069. listen = 192.168.0.1:5000
  11070. listen = /var/run/sphinx.s
  11071. listen = 9312
  11072. listen = localhost:9306:mysql41
  11073. </pre><p>
  11074. There can be multiple listen directives, <code class="code">searchd</code> will
  11075. listen for client connections on all specified ports and sockets. If
  11076. no <code class="code">listen</code> directives are found then the server will listen
  11077. on all available interfaces using the default SphinxAPI port 9312.
  11078. Starting with 1.10-beta, it will also listen on default SphinxQL
  11079. port 9306. Both port numbers are assigned by IANA (see
  11080. <a class="ulink" href="http://www.iana.org/assignments/port-numbers" target="_top">http://www.iana.org/assignments/port-numbers</a>
  11081. for details) and should therefore be available.
  11082. </p><p>
  11083. Unix-domain sockets are not supported on Windows.
  11084. </p></div>
  11085. <div class="sect2" title="12.4.2.&nbsp;log"><div class="titlepage"><div><div><h3 class="title"><a name="conf-log"></a>12.4.2.&nbsp;log</h3></div></div></div>
  11086. <p>
  11087. Log file name.
  11088. Optional, default is 'searchd.log'.
  11089. All <code class="filename">searchd</code> run time events will be logged in this file.
  11090. </p><p>
  11091. Also you can use the 'syslog' as the file name. In this case the events will be sent to syslog daemon.
  11092. To use the syslog option the sphinx must be configured '--with-syslog' on building.
  11093. </p><h4><a name="idp33923568"></a>Example:</h4><pre class="programlisting">
  11094. log = /var/log/searchd.log
  11095. </pre></div>
  11096. <div class="sect2" title="12.4.3.&nbsp;query_log"><div class="titlepage"><div><div><h3 class="title"><a name="conf-query-log"></a>12.4.3.&nbsp;query_log</h3></div></div></div>
  11097. <p>
  11098. Query log file name.
  11099. Optional, default is empty (do not log queries).
  11100. All search queries will be logged in this file. The format is described in <a class="xref" href="#query-log-format" title="5.9.&nbsp;searchd query log formats">Section&nbsp;5.9, &#8220;<code class="filename">searchd</code> query log formats&#8221;</a>.
  11101. </p><p>
  11102. In case of 'plain' format, you can use the 'syslog' as the path to the log file.
  11103. In this case all search queries will be sent to syslog daemon with LOG_INFO priority,
  11104. prefixed with '[query]' instead of timestamp.
  11105. To use the syslog option the sphinx must be configured '--with-syslog' on building.
  11106. </p><h4><a name="idp33927712"></a>Example:</h4><pre class="programlisting">
  11107. query_log = /var/log/query.log
  11108. </pre></div>
  11109. <div class="sect2" title="12.4.4.&nbsp;query_log_format"><div class="titlepage"><div><div><h3 class="title"><a name="conf-query-log-format"></a>12.4.4.&nbsp;query_log_format</h3></div></div></div>
  11110. <p>
  11111. Query log format.
  11112. Optional, allowed values are 'plain' and 'sphinxql', default is 'plain'.
  11113. Introduced in version 2.0.1-beta.
  11114. </p><p>
  11115. Starting with version 2.0.1-beta, two different log formats are supported.
  11116. The default one logs queries in a custom text format. The new one logs
  11117. valid SphinxQL statements. This directive allows to switch between the two
  11118. formats on search daemon startup. The log format can also be altered
  11119. on the fly, using <code class="code">SET GLOBAL query_log_format=sphinxql</code> syntax.
  11120. Refer to <a class="xref" href="#query-log-format" title="5.9.&nbsp;searchd query log formats">Section&nbsp;5.9, &#8220;<code class="filename">searchd</code> query log formats&#8221;</a> for more discussion and format
  11121. details.
  11122. </p><h4><a name="idp33932336"></a>Example:</h4><pre class="programlisting">
  11123. query_log_format = sphinxql
  11124. </pre></div>
  11125. <div class="sect2" title="12.4.5.&nbsp;read_timeout"><div class="titlepage"><div><div><h3 class="title"><a name="conf-read-timeout"></a>12.4.5.&nbsp;read_timeout</h3></div></div></div>
  11126. <p>
  11127. Network client request read timeout, in seconds.
  11128. Optional, default is 5 seconds.
  11129. <code class="filename">searchd</code> will forcibly close the client connections which fail to send a query within this timeout.
  11130. </p><h4><a name="idp33935856"></a>Example:</h4><pre class="programlisting">
  11131. read_timeout = 1
  11132. </pre></div>
  11133. <div class="sect2" title="12.4.6.&nbsp;client_timeout"><div class="titlepage"><div><div><h3 class="title"><a name="conf-client-timeout"></a>12.4.6.&nbsp;client_timeout</h3></div></div></div>
  11134. <p>
  11135. Maximum time to wait between requests (in seconds) when using
  11136. persistent connections. Optional, default is five minutes.
  11137. </p><h4><a name="idp33938576"></a>Example:</h4><pre class="programlisting">
  11138. client_timeout = 3600
  11139. </pre></div>
  11140. <div class="sect2" title="12.4.7.&nbsp;max_children"><div class="titlepage"><div><div><h3 class="title"><a name="conf-max-children"></a>12.4.7.&nbsp;max_children</h3></div></div></div>
  11141. <p>
  11142. Maximum amount of children to fork (or in other words, concurrent searches to run in parallel).
  11143. Optional, default is 0 (unlimited).
  11144. </p><p>
  11145. Useful to control server load. There will be no more than this much concurrent
  11146. searches running, at all times. When the limit is reached, additional incoming
  11147. clients are dismissed with temporarily failure (SEARCHD_RETRY) status code
  11148. and a message stating that the server is maxed out.
  11149. </p><h4><a name="idp33942048"></a>Example:</h4><pre class="programlisting">
  11150. max_children = 10
  11151. </pre></div>
  11152. <div class="sect2" title="12.4.8.&nbsp;pid_file"><div class="titlepage"><div><div><h3 class="title"><a name="conf-pid-file"></a>12.4.8.&nbsp;pid_file</h3></div></div></div>
  11153. <p>
  11154. <code class="filename">searchd</code> process ID file name.
  11155. Mandatory.
  11156. </p><p>
  11157. PID file will be re-created (and locked) on startup. It will contain
  11158. head daemon process ID while the daemon is running, and it will be unlinked
  11159. on daemon shutdown. It's mandatory because Sphinx uses it internally
  11160. for a number of things: to check whether there already is a running instance
  11161. of <code class="filename">searchd</code>; to stop <code class="filename">searchd</code>;
  11162. to notify it that it should rotate the indexes. Can also be used for
  11163. different external automation scripts.
  11164. </p><h4><a name="idp33947600"></a>Example:</h4><pre class="programlisting">
  11165. pid_file = /var/run/searchd.pid
  11166. </pre></div>
  11167. <div class="sect2" title="12.4.9.&nbsp;seamless_rotate"><div class="titlepage"><div><div><h3 class="title"><a name="conf-seamless-rotate"></a>12.4.9.&nbsp;seamless_rotate</h3></div></div></div>
  11168. <p>
  11169. Prevents <code class="filename">searchd</code> stalls while rotating indexes with huge amounts of data to precache.
  11170. Optional, default is 1 (enable seamless rotation).
  11171. </p><p>
  11172. Indexes may contain some data that needs to be precached in RAM.
  11173. At the moment, <code class="filename">.spa</code>, <code class="filename">.spi</code> and
  11174. <code class="filename">.spm</code> files are fully precached (they contain attribute data,
  11175. MVA data, and keyword index, respectively.)
  11176. Without seamless rotate, rotating an index tries to use as little RAM
  11177. as possible and works as follows:
  11178. </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>new queries are temporarily rejected (with "retry" error code);</p></li>
  11179. <li class="listitem"><p><code class="filename">searchd</code> waits for all currently running queries to finish;</p></li>
  11180. <li class="listitem"><p>old index is deallocated and its files are renamed;</p></li>
  11181. <li class="listitem"><p>new index files are renamed and required RAM is allocated;</p></li>
  11182. <li class="listitem"><p>new index attribute and dictionary data is preloaded to RAM;</p></li>
  11183. <li class="listitem"><p><code class="filename">searchd</code> resumes serving queries from new index.</p></li>
  11184. </ol></div>
  11185. <p>
  11186. </p><p>
  11187. However, if there's a lot of attribute or dictionary data, then preloading step
  11188. could take noticeable time - up to several minutes in case of preloading 1-5+ GB files.
  11189. </p><p>
  11190. With seamless rotate enabled, rotation works as follows:
  11191. </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>new index RAM storage is allocated;</p></li>
  11192. <li class="listitem"><p>new index attribute and dictionary data is asynchronously preloaded to RAM;</p></li>
  11193. <li class="listitem"><p>on success, old index is deallocated and both indexes' files are renamed;</p></li>
  11194. <li class="listitem"><p>on failure, new index is deallocated;</p></li>
  11195. <li class="listitem"><p>at any given moment, queries are served either from old or new index copy.</p></li>
  11196. </ol></div>
  11197. <p>
  11198. </p><p>
  11199. Seamless rotate comes at the cost of higher <span class="bold"><strong>peak</strong></span>
  11200. memory usage during the rotation (because both old and new copies of
  11201. <code class="filename">.spa/.spi/.spm</code> data need to be in RAM while
  11202. preloading new copy). Average usage stays the same.
  11203. </p><h4><a name="idp33966336"></a>Example:</h4><pre class="programlisting">
  11204. seamless_rotate = 1
  11205. </pre></div>
  11206. <div class="sect2" title="12.4.10.&nbsp;preopen_indexes"><div class="titlepage"><div><div><h3 class="title"><a name="conf-preopen-indexes"></a>12.4.10.&nbsp;preopen_indexes</h3></div></div></div>
  11207. <p>
  11208. Whether to forcibly preopen all indexes on startup.
  11209. Optional, default is 1 (preopen everything).
  11210. </p><p>
  11211. Starting with 2.0.1-beta, the default value for this
  11212. option is now 1 (foribly preopen all indexes). In prior
  11213. versions, it used to be 0 (use per-index settings).
  11214. </p><p>
  11215. When set to 1, this directive overrides and enforces
  11216. <a class="link" href="#conf-preopen" title="12.2.36.&nbsp;preopen">preopen</a> on all indexes.
  11217. They will be preopened, no matter what is the per-index
  11218. <code class="code">preopen</code> setting. When set to 0, per-index
  11219. settings can take effect. (And they default to 0.)
  11220. </p><p>
  11221. Pre-opened indexes avoid races between search queries
  11222. and rotations that can cause queries to fail occasionally.
  11223. They also make <code class="filename">searchd</code> use more file
  11224. handles. In most scenarios it's therefore preferred and
  11225. recommended to preopen indexes.
  11226. </p><h4><a name="idp33972848"></a>Example:</h4><pre class="programlisting">
  11227. preopen_indexes = 1
  11228. </pre></div>
  11229. <div class="sect2" title="12.4.11.&nbsp;unlink_old"><div class="titlepage"><div><div><h3 class="title"><a name="conf-unlink-old"></a>12.4.11.&nbsp;unlink_old</h3></div></div></div>
  11230. <p>
  11231. Whether to unlink .old index copies on successful rotation.
  11232. Optional, default is 1 (do unlink).
  11233. </p><h4><a name="idp33975600"></a>Example:</h4><pre class="programlisting">
  11234. unlink_old = 0
  11235. </pre></div>
  11236. <div class="sect2" title="12.4.12.&nbsp;attr_flush_period"><div class="titlepage"><div><div><h3 class="title"><a name="conf-attr-flush-period"></a>12.4.12.&nbsp;attr_flush_period</h3></div></div></div>
  11237. <p>
  11238. When calling <code class="code">UpdateAttributes()</code> to update document attributes in
  11239. real-time, changes are first written to the in-memory copy of attributes
  11240. (<code class="option">docinfo</code> must be set to <code class="option">extern</code>).
  11241. Then, once <code class="filename">searchd</code> shuts down normally (via <code class="code">SIGTERM</code>
  11242. being sent), the changes are written to disk.
  11243. Introduced in version 0.9.9-rc1.
  11244. </p><p>Starting with 0.9.9-rc1, it is possible to tell <code class="filename">searchd</code>
  11245. to periodically write these changes back to disk, to avoid them being lost. The time
  11246. between those intervals is set with <code class="option">attr_flush_period</code>, in seconds.
  11247. </p><p>It defaults to 0, which disables the periodic flushing, but flushing will
  11248. still occur at normal shut-down.
  11249. </p><h4><a name="idp33983152"></a>Example:</h4><pre class="programlisting">
  11250. attr_flush_period = 900 # persist updates to disk every 15 minutes
  11251. </pre></div>
  11252. <div class="sect2" title="12.4.13.&nbsp;max_packet_size"><div class="titlepage"><div><div><h3 class="title"><a name="conf-max-packet-size"></a>12.4.13.&nbsp;max_packet_size</h3></div></div></div>
  11253. <p>
  11254. Maximum allowed network packet size.
  11255. Limits both query packets from clients, and response packets from remote agents in distributed environment.
  11256. Only used for internal sanity checks, does not directly affect RAM use or performance.
  11257. Optional, default is 8M.
  11258. Introduced in version 0.9.9-rc1.
  11259. </p><h4><a name="idp33986144"></a>Example:</h4><pre class="programlisting">
  11260. max_packet_size = 32M
  11261. </pre></div>
  11262. <div class="sect2" title="12.4.14.&nbsp;mva_updates_pool"><div class="titlepage"><div><div><h3 class="title"><a name="conf-mva-updates-pool"></a>12.4.14.&nbsp;mva_updates_pool</h3></div></div></div>
  11263. <p>
  11264. Shared pool size for in-memory MVA updates storage.
  11265. Optional, default size is 1M.
  11266. Introduced in version 0.9.9-rc1.
  11267. </p><p>
  11268. This setting controls the size of the shared storage pool for updated MVA values.
  11269. Specifying 0 for the size disable MVA updates at all. Once the pool size limit
  11270. is hit, MVA update attempts will result in an error. However, updates on regular
  11271. (scalar) attributes will still work. Due to internal technical difficulties,
  11272. currently it is <span class="bold"><strong>not</strong></span> possible to store (flush) <span class="bold"><strong>any</strong></span> updates on indexes
  11273. where MVA were updated; though this might be implemented in the future.
  11274. In the meantime, MVA updates are intended to be used as a measure to quickly
  11275. catchup with latest changes in the database until the next index rebuild;
  11276. not as a persistent storage mechanism.
  11277. </p><h4><a name="idp33991264"></a>Example:</h4><pre class="programlisting">
  11278. mva_updates_pool = 16M
  11279. </pre></div>
  11280. <div class="sect2" title="12.4.15.&nbsp;max_filters"><div class="titlepage"><div><div><h3 class="title"><a name="conf-max-filters"></a>12.4.15.&nbsp;max_filters</h3></div></div></div>
  11281. <p>
  11282. Maximum allowed per-query filter count.
  11283. Only used for internal sanity checks, does not directly affect RAM use or performance.
  11284. Optional, default is 256.
  11285. Introduced in version 0.9.9-rc1.
  11286. </p><h4><a name="idp33994080"></a>Example:</h4><pre class="programlisting">
  11287. max_filters = 1024
  11288. </pre></div>
  11289. <div class="sect2" title="12.4.16.&nbsp;max_filter_values"><div class="titlepage"><div><div><h3 class="title"><a name="conf-max-filter-values"></a>12.4.16.&nbsp;max_filter_values</h3></div></div></div>
  11290. <p>
  11291. Maximum allowed per-filter values count.
  11292. Only used for internal sanity checks, does not directly affect RAM use or performance.
  11293. Optional, default is 4096.
  11294. Introduced in version 0.9.9-rc1.
  11295. </p><h4><a name="idp33996928"></a>Example:</h4><pre class="programlisting">
  11296. max_filter_values = 16384
  11297. </pre></div>
  11298. <div class="sect2" title="12.4.17.&nbsp;listen_backlog"><div class="titlepage"><div><div><h3 class="title"><a name="conf-listen-backlog"></a>12.4.17.&nbsp;listen_backlog</h3></div></div></div>
  11299. <p>
  11300. TCP listen backlog.
  11301. Optional, default is 5.
  11302. </p><p>
  11303. Windows builds currently (as of 0.9.9) can only process the requests
  11304. one by one. Concurrent requests will be enqueued by the TCP stack
  11305. on OS level, and requests that can not be enqueued will immediately
  11306. fail with "connection refused" message. listen_backlog directive
  11307. controls the length of the connection queue. Non-Windows builds
  11308. should work fine with the default value.
  11309. </p><h4><a name="idp34000368"></a>Example:</h4><pre class="programlisting">
  11310. listen_backlog = 20
  11311. </pre></div>
  11312. <div class="sect2" title="12.4.18.&nbsp;read_buffer"><div class="titlepage"><div><div><h3 class="title"><a name="conf-read-buffer"></a>12.4.18.&nbsp;read_buffer</h3></div></div></div>
  11313. <p>
  11314. Per-keyword read buffer size.
  11315. Optional, default is 256K.
  11316. </p><p>
  11317. For every keyword occurrence in every search query, there are
  11318. two associated read buffers (one for document list and one for
  11319. hit list). This setting lets you control their sizes, increasing
  11320. per-query RAM use, but possibly decreasing IO time.
  11321. </p><h4><a name="idp34003728"></a>Example:</h4><pre class="programlisting">
  11322. read_buffer = 1M
  11323. </pre></div>
  11324. <div class="sect2" title="12.4.19.&nbsp;read_unhinted"><div class="titlepage"><div><div><h3 class="title"><a name="conf-read-unhinted"></a>12.4.19.&nbsp;read_unhinted</h3></div></div></div>
  11325. <p>
  11326. Unhinted read size.
  11327. Optional, default is 32K.
  11328. </p><p>
  11329. When querying, some reads know in advance exactly how much data
  11330. is there to be read, but some currently do not. Most prominently,
  11331. hit list size in not currently known in advance. This setting
  11332. lest you control how much data to read in such cases. It will
  11333. impact hit list IO time, reducing it for lists larger than
  11334. unhinted read size, but raising it for smaller lists. It will
  11335. <span class="bold"><strong>not</strong></span> affect RAM use because read buffer will be already
  11336. allocated. So it should be not greater than read_buffer.
  11337. </p><h4><a name="idp34007936"></a>Example:</h4><pre class="programlisting">
  11338. read_unhinted = 32K
  11339. </pre></div>
  11340. <div class="sect2" title="12.4.20.&nbsp;max_batch_queries"><div class="titlepage"><div><div><h3 class="title"><a name="conf-max-batch-queries"></a>12.4.20.&nbsp;max_batch_queries</h3></div></div></div>
  11341. <p>
  11342. Limits the amount of queries per batch.
  11343. Optional, default is 32.
  11344. </p><p>
  11345. Makes searchd perform a sanity check of the amount of the queries
  11346. submitted in a single batch when using <a class="link" href="#multi-queries" title="5.11.&nbsp;Multi-queries">multi-queries</a>.
  11347. Set it to 0 to skip the check.
  11348. </p><h4><a name="idp34011968"></a>Example:</h4><pre class="programlisting">
  11349. max_batch_queries = 256
  11350. </pre></div>
  11351. <div class="sect2" title="12.4.21.&nbsp;subtree_docs_cache"><div class="titlepage"><div><div><h3 class="title"><a name="conf-subtree-docs-cache"></a>12.4.21.&nbsp;subtree_docs_cache</h3></div></div></div>
  11352. <p>
  11353. Max common subtree document cache size, per-query.
  11354. Optional, default is 0 (disabled).
  11355. </p><p>
  11356. Limits RAM usage of a common subtree optimizer (see <a class="xref" href="#multi-queries" title="5.11.&nbsp;Multi-queries">Section&nbsp;5.11, &#8220;Multi-queries&#8221;</a>).
  11357. At most this much RAM will be spent to cache document entries per each query.
  11358. Setting the limit to 0 disables the optimizer.
  11359. </p><h4><a name="idp34015936"></a>Example:</h4><pre class="programlisting">
  11360. subtree_docs_cache = 8M
  11361. </pre></div>
  11362. <div class="sect2" title="12.4.22.&nbsp;subtree_hits_cache"><div class="titlepage"><div><div><h3 class="title"><a name="conf-subtree-hits-cache"></a>12.4.22.&nbsp;subtree_hits_cache</h3></div></div></div>
  11363. <p>
  11364. Max common subtree hit cache size, per-query.
  11365. Optional, default is 0 (disabled).
  11366. </p><p>
  11367. Limits RAM usage of a common subtree optimizer (see <a class="xref" href="#multi-queries" title="5.11.&nbsp;Multi-queries">Section&nbsp;5.11, &#8220;Multi-queries&#8221;</a>).
  11368. At most this much RAM will be spent to cache keyword occurrences (hits) per each query.
  11369. Setting the limit to 0 disables the optimizer.
  11370. </p><h4><a name="idp34019888"></a>Example:</h4><pre class="programlisting">
  11371. subtree_hits_cache = 16M
  11372. </pre></div>
  11373. <div class="sect2" title="12.4.23.&nbsp;workers"><div class="titlepage"><div><div><h3 class="title"><a name="conf-workers"></a>12.4.23.&nbsp;workers</h3></div></div></div>
  11374. <p>
  11375. Multi-processing mode (MPM).
  11376. Optional; allowed values are none, fork, prefork, and threads.
  11377. Default is threads.
  11378. Introduced in version 1.10-beta.
  11379. </p><p>
  11380. Lets you choose how <code class="filename">searchd</code> processes multiple
  11381. concurrent requests. The possible values are:
  11382. </p><div class="variablelist"><dl><dt><span class="term">none</span></dt>
  11383. <dd><p>All requests will be handled serially, one-by-one.
  11384. Prior to 1.x, this was the only mode available on Windows.
  11385. </p></dd><dt><span class="term">fork</span></dt>
  11386. <dd><p>A new child process will be forked to handle every
  11387. incoming request.
  11388. </p></dd><dt><span class="term">prefork</span></dt>
  11389. <dd><p>On startup, <code class="filename">searchd</code> will pre-fork
  11390. a number of worker processes, and pass the incoming requests
  11391. to one of those children.
  11392. </p></dd><dt><span class="term">threads</span></dt>
  11393. <dd><p>A new thread will be created to handle every
  11394. incoming request. This is the only mode compatible with
  11395. RT indexing backend. This is a default value.
  11396. </p></dd></dl></div>
  11397. <p>
  11398. </p><p>
  11399. Historically, <code class="filename">searchd</code> used fork-based model,
  11400. which generally performs OK but spends a noticeable amount of CPU
  11401. in fork() system call when there's a high amount of (tiny) requests
  11402. per second. Prefork mode was implemented to alleviate that; with
  11403. prefork, worker processes are basically only created on startup
  11404. and re-created on index rotation, somewhat reducing fork() call
  11405. pressure.
  11406. </p><p>
  11407. Threads mode was implemented along with RT backend and is required
  11408. to use RT indexes. (Regular disk-based indexes work in all the
  11409. available modes.)
  11410. </p><h4><a name="idp34032752"></a>Example:</h4><pre class="programlisting">
  11411. workers = threads
  11412. </pre></div>
  11413. <div class="sect2" title="12.4.24.&nbsp;dist_threads"><div class="titlepage"><div><div><h3 class="title"><a name="conf-dist-threads"></a>12.4.24.&nbsp;dist_threads</h3></div></div></div>
  11414. <p>
  11415. Max local worker threads to use for parallelizable requests (searching a distributed index; building a batch of snippets).
  11416. Optional, default is 0, which means to disable in-request parallelism.
  11417. Introduced in version 1.10-beta.
  11418. </p><p>
  11419. Distributed index can include several local indexes. <code class="option">dist_threads</code>
  11420. lets you easily utilize multiple CPUs/cores for that (previously existing
  11421. alternative was to specify the indexes as remote agents, pointing searchd
  11422. to itself and paying some network overheads).
  11423. </p><p>
  11424. When set to a value N greater than 1, this directive will create up to
  11425. N threads for every query, and schedule the specific searches within these
  11426. threads. For example, if there are 7 local indexes to search and dist_threads
  11427. is set to 2, then 2 parallel threads would be created: one that sequentially
  11428. searches 4 indexes, and another one that searches the other 3 indexes.
  11429. </p><p>
  11430. In case of CPU bound workload, setting <code class="option">dist_threads</code>
  11431. to 1x the number of cores is advised (creating more threads than cores
  11432. will not improve query time). In case of mixed CPU/disk bound workload
  11433. it might sometimes make sense to use more (so that all cores could be
  11434. utilizes even when there are threads that wait for I/O completion).
  11435. </p><p>
  11436. Note that <code class="option">dist_threads</code> does <span class="bold"><strong>not</strong></span> require
  11437. threads MPM. You can perfectly use it with fork or prefork MPMs too.
  11438. </p><p>
  11439. Starting with version 2.0.1-beta, building a batch of snippets
  11440. with <code class="option">load_files</code> flag enabled can also be parallelized.
  11441. Up to <code class="option">dist_threads</code> threads are be created to process
  11442. those files. That speeds up snippet extraction when the total amount
  11443. of document data to process is significant (hundreds of megabytes).
  11444. </p><h4><a name="idp34041760"></a>Example:</h4><pre class="programlisting">
  11445. index dist_test
  11446. {
  11447. type = distributed
  11448. local = chunk1
  11449. local = chunk2
  11450. local = chunk3
  11451. local = chunk4
  11452. }
  11453. # ...
  11454. dist_threads = 4
  11455. </pre></div>
  11456. <div class="sect2" title="12.4.25.&nbsp;binlog_path"><div class="titlepage"><div><div><h3 class="title"><a name="conf-binlog-path"></a>12.4.25.&nbsp;binlog_path</h3></div></div></div>
  11457. <p>
  11458. Binary log (aka transaction log) files path.
  11459. Optional, default is build-time configured data directory.
  11460. Introduced in version 1.10-beta.
  11461. </p><p>
  11462. Binary logs are used for crash recovery of RT index data, and also of
  11463. attributes updates of plain disk indices that
  11464. would otherwise only be stored in RAM until flush. When logging is enabled,
  11465. every transaction COMMIT-ted into RT index gets written into
  11466. a log file. Logs are then automatically replayed on startup
  11467. after an unclean shutdown, recovering the logged changes.
  11468. </p><p>
  11469. <code class="option">binlog_path</code> directive specifies the binary log
  11470. files location. It should contain just the path; <code class="option">searchd</code>
  11471. will create and unlink multiple binlog.* files in that path as necessary
  11472. (binlog data, metadata, and lock files, etc).
  11473. </p><p>
  11474. Empty value disables binary logging. That improves performance,
  11475. but puts RT index data at risk.
  11476. </p><p>
  11477. WARNING! It is strongly recommended to always explicitly define 'binlog_path' option in your config.
  11478. Otherwise, the default path, which in most cases is the same as working folder, may point to the
  11479. folder with no write access (for example, /usr/local/var/data). In this case, the searchd
  11480. will not start at all.
  11481. </p><h4><a name="idp34048080"></a>Example:</h4><pre class="programlisting">
  11482. binlog_path = # disable logging
  11483. binlog_path = /var/data # /var/data/binlog.001 etc will be created
  11484. </pre></div>
  11485. <div class="sect2" title="12.4.26.&nbsp;binlog_flush"><div class="titlepage"><div><div><h3 class="title"><a name="conf-binlog-flush"></a>12.4.26.&nbsp;binlog_flush</h3></div></div></div>
  11486. <p>
  11487. Binary log transaction flush/sync mode.
  11488. Optional, default is 2 (flush every transaction, sync every second).
  11489. Introduced in version 1.10-beta.
  11490. </p><p>
  11491. This directive controls how frequently will binary log be flushed
  11492. to OS and synced to disk. Three modes are supported:
  11493. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>0, flush and sync every second. Best performance,
  11494. but up to 1 second worth of committed transactions can be lost
  11495. both on daemon crash, or OS/hardware crash.
  11496. </p></li>
  11497. <li class="listitem"><p>1, flush and sync every transaction. Worst performance,
  11498. but every committed transaction data is guaranteed to be saved.
  11499. </p></li>
  11500. <li class="listitem"><p>2, flush every transaction, sync every second.
  11501. Good performance, and every committed transaction is guaranteed
  11502. to be saved in case of daemon crash. However, in case of OS/hardware
  11503. crash up to 1 second worth of committed transactions can be lost.
  11504. </p></li>
  11505. </ul></div>
  11506. <p>
  11507. </p><p>
  11508. For those familiar with MySQL and InnoDB, this directive is entirely
  11509. similar to <code class="option">innodb_flush_log_at_trx_commit</code>. In most
  11510. cases, the default hybrid mode 2 provides a nice balance of speed
  11511. and safety, with full RT index data protection against daemon crashes,
  11512. and some protection against hardware ones.
  11513. </p><h4><a name="idp34055056"></a>Example:</h4><pre class="programlisting">
  11514. binlog_flush = 1 # ultimate safety, low speed
  11515. </pre></div>
  11516. <div class="sect2" title="12.4.27.&nbsp;binlog_max_log_size"><div class="titlepage"><div><div><h3 class="title"><a name="conf-binlog-max-log-size"></a>12.4.27.&nbsp;binlog_max_log_size</h3></div></div></div>
  11517. <p>
  11518. Maximum binary log file size.
  11519. Optional, default is 0 (do not reopen binlog file based on size).
  11520. Introduced in version 1.10-beta.
  11521. </p><p>
  11522. A new binlog file will be forcibly opened once the current binlog file
  11523. reaches this limit. This achieves a finer granularity of logs and can yield
  11524. more efficient binlog disk usage under certain borderline workloads.
  11525. </p><h4><a name="idp34058528"></a>Example:</h4><pre class="programlisting">
  11526. binlog_max_log_size = 16M
  11527. </pre></div>
  11528. <div class="sect2" title="12.4.28.&nbsp;snippets_file_prefix"><div class="titlepage"><div><div><h3 class="title"><a name="conf-snippets-file-prefix"></a>12.4.28.&nbsp;snippets_file_prefix</h3></div></div></div>
  11529. <p>
  11530. A prefix to prepend to the local file names when generating snippets.
  11531. Optional, default is empty.
  11532. Introduced in version 2.1.1-beta.
  11533. </p><p>
  11534. This prefix can be used in distributed snippets generation along with
  11535. <code class="option">load_files</code> or <code class="option">load_files_scattered</code> options.
  11536. </p><p>
  11537. Note how this is a prefix, and <span class="bold"><strong>not</strong></span> a path! Meaning that if a prefix
  11538. is set to "server1" and the request refers to "file23", <code class="filename">searchd</code>
  11539. will attempt to open "server1file23" (all of that without quotes). So if you
  11540. need it to be a path, you have to mention the trailing slash.
  11541. </p><p>
  11542. Note also that this is a local option, it does not affect the agents anyhow.
  11543. So you can safely set a prefix on a master server. The requests routed to the
  11544. agents will not be affected by the master's setting. They will however be affected
  11545. by the agent's own settings.
  11546. </p><p>
  11547. This might be useful, for instance, when the document storage locations
  11548. (be those local storage or NAS mountpoints) are inconsistent across the servers.
  11549. </p><h4><a name="idp34065840"></a>Example:</h4><pre class="programlisting">
  11550. snippets_file_prefix = /mnt/common/server1/
  11551. </pre></div>
  11552. <div class="sect2" title="12.4.29.&nbsp;collation_server"><div class="titlepage"><div><div><h3 class="title"><a name="conf-collation-server"></a>12.4.29.&nbsp;collation_server</h3></div></div></div>
  11553. <p>
  11554. Default server collation.
  11555. Optional, default is libc_ci.
  11556. Introduced in version 2.0.1-beta.
  11557. </p><p>
  11558. Specifies the default collation used for incoming requests.
  11559. The collation can be overridden on a per-query basis.
  11560. Refer to <a class="xref" href="#collations" title="5.12.&nbsp;Collations">Section&nbsp;5.12, &#8220;Collations&#8221;</a> section for the list of available collations and other details.
  11561. </p><h4><a name="idp34069856"></a>Example:</h4><pre class="programlisting">
  11562. collation_server = utf8_ci
  11563. </pre></div>
  11564. <div class="sect2" title="12.4.30.&nbsp;collation_libc_locale"><div class="titlepage"><div><div><h3 class="title"><a name="conf-collation-libc-locale"></a>12.4.30.&nbsp;collation_libc_locale</h3></div></div></div>
  11565. <p>
  11566. Server libc locale.
  11567. Optional, default is C.
  11568. Introduced in version 2.0.1-beta.
  11569. </p><p>
  11570. Specifies the libc locale, affecting the libc-based collations.
  11571. Refer to <a class="xref" href="#collations" title="5.12.&nbsp;Collations">Section&nbsp;5.12, &#8220;Collations&#8221;</a> section for the details.
  11572. </p><h4><a name="idp34073760"></a>Example:</h4><pre class="programlisting">
  11573. collation_libc_locale = fr_FR
  11574. </pre></div>
  11575. <div class="sect2" title="12.4.31.&nbsp;plugin_dir"><div class="titlepage"><div><div><h3 class="title"><a name="conf-plugin-dir"></a>12.4.31.&nbsp;plugin_dir</h3></div></div></div>
  11576. <p>
  11577. Trusted location for the dynamic libraries (UDFs).
  11578. Optional, default is empty (no location).
  11579. Introduced in version 2.0.1-beta.
  11580. </p><p>
  11581. Specifies the trusted directory from which the
  11582. <a class="link" href="#sphinx-udfs" title="6.1.&nbsp;Sphinx UDFs (User Defined Functions)">UDF libraries</a> can be loaded. Requires
  11583. <a class="link" href="#conf-workers" title="12.4.23.&nbsp;workers">workers = thread</a> to take effect.
  11584. </p><h4><a name="idp34078608"></a>Example:</h4><pre class="programlisting">
  11585. workers = threads
  11586. plugin_dir = /usr/local/sphinx/lib
  11587. </pre></div>
  11588. <div class="sect2" title="12.4.32.&nbsp;mysql_version_string"><div class="titlepage"><div><div><h3 class="title"><a name="conf-mysql-version-string"></a>12.4.32.&nbsp;mysql_version_string</h3></div></div></div>
  11589. <p>
  11590. A server version string to return via MySQL protocol.
  11591. Optional, default is empty (return Sphinx version).
  11592. Introduced in version 2.0.1-beta.
  11593. </p><p>
  11594. Several picky MySQL client libraries depend on a particular version
  11595. number format used by MySQL, and moreover, sometimes choose a different
  11596. execution path based on the reported version number (rather than the
  11597. indicated capabilities flags). For instance, Python MySQLdb 1.2.2 throws
  11598. an exception when the version number is not in X.Y.ZZ format; MySQL .NET
  11599. connector 6.3.x fails internally on version numbers 1.x along with
  11600. a certain combination of flags, etc. To workaround that, you can use
  11601. <code class="option">mysql_version_string</code> directive and have <code class="filename">searchd</code>
  11602. report a different version to clients connecting over MySQL protocol.
  11603. (By default, it reports its own version.)
  11604. </p><h4><a name="idp34083568"></a>Example:</h4><pre class="programlisting">
  11605. mysql_version_string = 5.0.37
  11606. </pre></div>
  11607. <div class="sect2" title="12.4.33.&nbsp;rt_flush_period"><div class="titlepage"><div><div><h3 class="title"><a name="conf-rt-flush-period"></a>12.4.33.&nbsp;rt_flush_period</h3></div></div></div>
  11608. <p>
  11609. RT indexes RAM chunk flush check period, in seconds.
  11610. Optional, default is 10 hours.
  11611. Introduced in version 2.0.1-beta.
  11612. </p><p>
  11613. Actively updated RT indexes that however fully fit in RAM chunks
  11614. can result in ever-growing binlogs, impacting disk use and crash
  11615. recovery time. With this directive the search daemon performs
  11616. periodic flush checks, and eligible RAM chunks can get saved,
  11617. enabling consequential binlog cleanup. See <a class="xref" href="#rt-binlog" title="4.4.&nbsp;Binary logging">Section&nbsp;4.4, &#8220;Binary logging&#8221;</a>
  11618. for more details.
  11619. </p><h4><a name="idp34087632"></a>Example:</h4><pre class="programlisting">
  11620. rt_flush_period = 3600 # 1 hour
  11621. </pre></div>
  11622. <div class="sect2" title="12.4.34.&nbsp;thread_stack"><div class="titlepage"><div><div><h3 class="title"><a name="conf-thread-stack"></a>12.4.34.&nbsp;thread_stack</h3></div></div></div>
  11623. <p>
  11624. Per-thread stack size.
  11625. Optional, default is 1M.
  11626. Introduced in version 2.0.1-beta.
  11627. </p><p>
  11628. In the <code class="code">workers = threads</code> mode, every request is processed
  11629. with a separate thread that needs its own stack space. By default, 1M per
  11630. thread are allocated for stack. However, extremely complex search requests
  11631. might eventually exhaust the default stack and require more. For instance,
  11632. a query that matches a thousands of keywords (either directly or through
  11633. term expansion) can eventually run out of stack. Previously, that resulted
  11634. in crashes. Starting with 2.0.1-beta, <code class="filename">searchd</code> attempts
  11635. to estimate the expected stack use, and blocks the potentially dangerous
  11636. queries. To process such queries, you can either the thread stack size
  11637. by using the <code class="code">thread_stack</code> directive (or switch to a different
  11638. <code class="code">workers</code> setting if that is possible).
  11639. </p><p>
  11640. A query with N levels of nesting is estimated to require approximately
  11641. 30+0.16*N KB of stack, meaning that the default 64K is enough for queries
  11642. with upto 250 levels, 150K for upto 700 levels, etc. If the stack size limit
  11643. is not met, <code class="filename">searchd</code> fails the query and reports
  11644. the required stack size in the error message.
  11645. </p><h4><a name="idp34094784"></a>Example:</h4><pre class="programlisting">
  11646. thread_stack = 256K
  11647. </pre></div>
  11648. <div class="sect2" title="12.4.35.&nbsp;expansion_limit"><div class="titlepage"><div><div><h3 class="title"><a name="conf-expansion-limit"></a>12.4.35.&nbsp;expansion_limit</h3></div></div></div>
  11649. <p>
  11650. The maximum number of expanded keywords for a single wildcard.
  11651. Optional, default is 0 (no limit).
  11652. Introduced in version 2.0.1-beta.
  11653. </p><p>
  11654. When doing substring searches against indexes built with
  11655. <code class="code">dict = keywords</code> enabled, a single wildcard may
  11656. potentially result in thousands and even millions of matched
  11657. keywords (think of matching 'a*' against the entire Oxford
  11658. dictionary). This directive lets you limit the impact
  11659. of such expansions. Setting <code class="code">expansion_limit = N</code>
  11660. restricts expansions to no more than N of the most frequent
  11661. matching keywords (per each wildcard in the query).
  11662. </p><h4><a name="idp34099136"></a>Example:</h4><pre class="programlisting">
  11663. expansion_limit = 16
  11664. </pre></div>
  11665. <div class="sect2" title="12.4.36.&nbsp;watchdog"><div class="titlepage"><div><div><h3 class="title"><a name="conf-watchdog"></a>12.4.36.&nbsp;watchdog</h3></div></div></div>
  11666. <p>
  11667. Threaded server watchdog.
  11668. Optional, default is 1 (watchdog enabled).
  11669. Introduced in version 2.0.1-beta.
  11670. </p><p>
  11671. A crashed query in <code class="code">threads</code> multi-processing mode
  11672. (<code class="code"><a class="link" href="#conf-workers" title="12.4.23.&nbsp;workers">workers</a> = threads</code>)
  11673. can take down the entire server. With watchdog feature enabled,
  11674. <code class="filename">searchd</code> additionally keeps a separate lightweight
  11675. process that monitors the main server process, and automatically
  11676. restarts the latter in case of abnormal termination. Watchdog
  11677. is enabled by default.
  11678. </p><h4><a name="idp34104800"></a>Example:</h4><pre class="programlisting">
  11679. watchdog = 0 # disable watchdog
  11680. </pre></div>
  11681. <div class="sect2" title="12.4.37.&nbsp;prefork_rotation_throttle"><div class="titlepage"><div><div><h3 class="title"><a name="conf-prefork-rotation-throttle"></a>12.4.37.&nbsp;prefork_rotation_throttle</h3></div></div></div>
  11682. <p>
  11683. Delay between restarting preforked children on index rotation, in milliseconds.
  11684. Optional, default is 0 (no delay).
  11685. Introduced in version 2.0.2-beta.
  11686. </p><p>
  11687. When running in <code class="code"><a class="link" href="#conf-workers" title="12.4.23.&nbsp;workers">workers</a> = prefork</code>
  11688. mode, every index rotation needs to restart all children to propagate the newly
  11689. loaded index data changes. Restarting all of them at once might put excessive
  11690. strain on CPU and/or network connections. (For instance, when the application
  11691. keeps a bunch of open persistent connections to different children, and all those
  11692. children restart.) Those bursts can be throttled down with
  11693. <code class="option">prefork_rotation_throttle</code> directive. Note that
  11694. the children will be restarted sequentially, and thus "old" results might
  11695. persist for a few more seconds. For instance, if
  11696. <code class="option">prefork_rotation_throttle</code> is set to 50 (milliseconds), and
  11697. there are 30 children, then the last one would only be <span class="emphasis"><em>actually</em></span>
  11698. restarted 1.5 seconds (50*30=1500 milliseconds) <span class="emphasis"><em>after</em></span>
  11699. the "rotation finished" message in the <code class="filename">searchd</code> event log.
  11700. </p><h4><a name="idp34112384"></a>Example:</h4><pre class="programlisting">
  11701. prefork_rotation_throttle = 50 # throttle children restarts by 50 msec each
  11702. </pre></div>
  11703. <div class="sect2" title="12.4.38.&nbsp;sphinxql_state"><div class="titlepage"><div><div><h3 class="title"><a name="conf-sphinxql-state"></a>12.4.38.&nbsp;sphinxql_state</h3></div></div></div>
  11704. <p>
  11705. Path to a file where current SphinxQL state will be serialized.
  11706. Available since version 2.1.1-beta.
  11707. </p><p>
  11708. On daemon startup, this file gets replayed. On eligible state changes (eg. SET GLOBAL),
  11709. this file gets rewritten automatically. This can prevent a hard-to-diagnose problem:
  11710. If you load UDF functions, but Sphinx crashes, when it
  11711. gets (automatically) restarted, your UDF and global variables will no longer be available;
  11712. using persistent state helps a graceful recovery with no such surprises.
  11713. </p><h4><a name="idp34115952"></a>Example:</h4><pre class="programlisting">
  11714. sphinxql_state = uservars.sql
  11715. </pre></div>
  11716. <div class="sect2" title="12.4.39.&nbsp;ha_ping_interval"><div class="titlepage"><div><div><h3 class="title"><a name="conf-ha-ping-interval"></a>12.4.39.&nbsp;ha_ping_interval</h3></div></div></div>
  11717. <p>
  11718. Interval between agent mirror pings, in milliseconds.
  11719. Optional, default is 1000.
  11720. Added in 2.1.1-beta.
  11721. </p><p>
  11722. For a distributed index with agent mirrors in it (see more in ???),
  11723. master sends all mirrors a ping command during the idle periods.
  11724. This is to track the current agent status (alive or dead, network
  11725. roundtrip, etc). The interval between such pings is defined
  11726. by this directive.
  11727. </p><p>
  11728. To disable pings, set ha_ping_interval to 0.
  11729. </p><h4><a name="idp34119728"></a>Example:</h4><pre class="programlisting">
  11730. ha_ping_interval = 0
  11731. </pre></div>
  11732. <div class="sect2" title="12.4.40.&nbsp;ha_period_karma"><div class="titlepage"><div><div><h3 class="title"><a name="conf-ha-period-karma"></a>12.4.40.&nbsp;ha_period_karma</h3></div></div></div>
  11733. <p>
  11734. Agent mirror statistics window size, in seconds.
  11735. Optional, default is 60.
  11736. Added in 2.1.1-beta.
  11737. </p><p>
  11738. For a distributed index with agent mirrors in it (see more in ???),
  11739. master tracks several different per-mirror counters. These counters
  11740. are then used for failover and balancing. (Master picks the best
  11741. mirror to use based on the counters.) Counters are accumulated in
  11742. blocks of <code class="code">ha_period_karma</code> seconds.
  11743. </p><p>
  11744. After beginning a new block, master may still use the accumulated
  11745. values from the previous one, until the new one is half full. Thus,
  11746. any previous history stops affecting the mirror choice after
  11747. 1.5 times ha_period_karma seconds at most.
  11748. </p><p>
  11749. Despite that at most 2 blocks are used for mirror selection,
  11750. upto 15 last blocks are actually stored, for instrumentation purposes.
  11751. They can be inspected using
  11752. <a class="link" href="#sphinxql-show-agent-status" title="8.29.&nbsp;SHOW AGENT STATUS">SHOW AGENT STATUS</a>
  11753. statement.
  11754. </p><h4><a name="idp34125664"></a>Example:</h4><pre class="programlisting">
  11755. ha_period_karma = 120
  11756. </pre></div>
  11757. <div class="sect2" title="12.4.41.&nbsp;persistent_connections_limit"><div class="titlepage"><div><div><h3 class="title"><a name="conf-persistent-connections-limit"></a>12.4.41.&nbsp;persistent_connections_limit</h3></div></div></div>
  11758. <p>
  11759. The maximum # of simultaneous persistent connections to remote <a class="link" href="#conf-agent-persistent" title="12.2.32.&nbsp;agent_persistent">persistent agents</a>.
  11760. Each time connecting agent defined under 'agent_persistent' we try to reuse existing connection (if any), or connect and save the connection for the future.
  11761. However we can't hold unlimited # of such persistent connections, since each one holds a worker on agent size (and finally we'll receive the 'maxed out' error,
  11762. when all of them are busy). This very directive limits the number. It affects the num of connections to each agent's host, across all distributed indexes.
  11763. </p><p>
  11764. It is reasonable to set the value equal or less than <a class="link" href="#conf-max-children" title="12.4.7.&nbsp;max_children">max_children</a> option of the agents.
  11765. </p><h4><a name="idp34131104"></a>Example:</h4><pre class="programlisting">
  11766. persistent_connections_limit = 29 # assume that each host of agents has max_children = 30 (or 29).
  11767. </pre></div>
  11768. <div class="sect2" title="12.4.42.&nbsp;rt_merge_iops"><div class="titlepage"><div><div><h3 class="title"><a name="conf-rt-merge-iops"></a>12.4.42.&nbsp;rt_merge_iops</h3></div></div></div>
  11769. <p>
  11770. A maximum number of I/O operations (per second) that the RT chunks merge thread is allowed to start.
  11771. Optional, default is 0 (no limit). Added in 2.1.1-beta.
  11772. </p><p>
  11773. This directive lets you throttle down the I/O impact arising from
  11774. the <code class="code">OPTIMIZE</code> statements. It is guaranteed that all the
  11775. RT optimization activity will not generate more disk iops (I/Os per second)
  11776. than the configured limit. Modern SATA drives can perform up to around 100 I/O operations per
  11777. second, and limiting rt_merge_iops can reduce search performance degradation caused by merging.
  11778. </p><h4><a name="idp34135152"></a>Example:</h4><pre class="programlisting">
  11779. rt_merge_iops = 40
  11780. </pre></div>
  11781. <div class="sect2" title="12.4.43.&nbsp;rt_merge_maxiosize"><div class="titlepage"><div><div><h3 class="title"><a name="conf-rt-merge-maxiosize"></a>12.4.43.&nbsp;rt_merge_maxiosize</h3></div></div></div>
  11782. <p>
  11783. A maximum size of an I/O operation that the RT chunks merge
  11784. thread is allowed to start.
  11785. Optional, default is 0 (no limit).
  11786. Added in 2.1.1-beta.
  11787. </p><p>
  11788. This directive lets you throttle down the I/O impact arising from
  11789. the <code class="code">OPTIMIZE</code> statements. I/Os bigger than this limit will be
  11790. broken down into 2 or more I/Os, which will then be accounted as separate I/Os
  11791. with regards to the <a class="link" href="#conf-rt-merge-iops" title="12.4.42.&nbsp;rt_merge_iops">rt_merge_iops</a>
  11792. limit. Thus, it is guaranteed that all the optimization activity will not
  11793. generate more than (rt_merge_iops * rt_merge_maxiosize) bytes of disk I/O
  11794. per second.
  11795. </p><h4><a name="idp34139920"></a>Example:</h4><pre class="programlisting">
  11796. rt_merge_maxiosize = 1M
  11797. </pre></div>
  11798. <div class="sect2" title="12.4.44.&nbsp;predicted_time_costs"><div class="titlepage"><div><div><h3 class="title"><a name="conf-predicted-time-costs"></a>12.4.44.&nbsp;predicted_time_costs</h3></div></div></div>
  11799. <p>
  11800. Costs for the query time prediction model, in nanoseconds.
  11801. Optional, default is "doc=64, hit=48, skip=2048, match=64" (without the quotes).
  11802. Added in 2.1.1-beta.
  11803. </p><p>
  11804. Terminating queries before completion based on their execution time
  11805. (via either <a class="link" href="#api-func-setmaxquerytime" title="9.2.2.&nbsp;SetMaxQueryTime">SetMaxQueryTime()</a>
  11806. API call, or <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">SELECT ... OPTION max_query_time</a>
  11807. SphinxQL statement) is a nice safety net, but it comes with an inborn drawback:
  11808. indeterministic (unstable) results. That is, if you repeat the very same (complex)
  11809. search query with a time limit several times, the time limit will get hit
  11810. at different stages, and you will get <span class="emphasis"><em>different</em></span> result sets.
  11811. </p><p>
  11812. Starting with 2.1.1-beta, there is a new option,
  11813. <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">SELECT ... OPTION max_predicted_time</a>,
  11814. that lets you limit the query time <span class="emphasis"><em>and</em></span> get stable,
  11815. repeatable results. Instead of regularly checking the actual current time
  11816. while evaluating the query, which is indeterministic, it predicts the current
  11817. running time using a simple linear model instead:
  11818. </p><pre class="programlisting">
  11819. predicted_time =
  11820. doc_cost * processed_documents +
  11821. hit_cost * processed_hits +
  11822. skip_cost * skiplist_jumps +
  11823. match_cost * found_matches
  11824. </pre><p>
  11825. The query is then terminated early when the <code class="code">predicted_time</code>
  11826. reaches a given limit.
  11827. </p><p>
  11828. Of course, this is not a hard limit on the actual time spent (it is, however,
  11829. a hard limit on the amount of <span class="emphasis"><em>processing</em></span> work done), and
  11830. a simple linear model is in no way an ideally precise one. So the wall clock time
  11831. <span class="emphasis"><em>may</em></span> be either below or over the target limit. However,
  11832. the error margins are quite acceptable: for instance, in our experiments with
  11833. a 100 msec target limit the majority of the test queries fell into a 95 to 105 msec
  11834. range, and <span class="emphasis"><em>all</em></span> of the queries were in a 80 to 120 msec range.
  11835. Also, as a nice side effect, using the modeled query time instead of measuring
  11836. actual run time results in somewhat less gettimeofday() calls, too.
  11837. </p><p>
  11838. No two server makes and models are identical, so <code class="code">predicted_time_costs</code>
  11839. directive lets you configure the costs for the model above. For convenience, they are
  11840. integers, counted in nanoseconds. (The limit in max_predicted_time is counted
  11841. in milliseconds, and having to specify cost values as 0.000128 ms instead of 128 ns
  11842. is somewhat more error prone.) It is not necessary to specify all 4 costs at once,
  11843. as the missed one will take the default values. However, we strongly suggest
  11844. to specify all of them, for readability.
  11845. </p><h4><a name="idp34152416"></a>Example:</h4><pre class="programlisting">
  11846. predicted_time_costs = doc=128, hit=96, skip=4096, match=128
  11847. </pre></div>
  11848. <div class="sect2" title="12.4.45.&nbsp;shutdown_timeout"><div class="titlepage"><div><div><h3 class="title"><a name="conf-shutdown-timeout"></a>12.4.45.&nbsp;shutdown_timeout</h3></div></div></div>
  11849. <p>
  11850. searchd --stopwait wait time, in seconds.
  11851. Optional, default is 3 seconds.
  11852. Added in 2.2.1-beta.
  11853. </p><p>
  11854. When you run searchd --stopwait your daemon needs to perform some
  11855. activities before stopping like finishing queries, flushing RT RAM chunk,
  11856. flushing attributes and updating binlog. And it requires some time.
  11857. searchd --stopwait will wait up to shutdown_time seconds for daemon to
  11858. finish its jobs. Suitable time depends on your index size and load.
  11859. </p><h4><a name="idp34155856"></a>Example:</h4><pre class="programlisting">
  11860. shutdown_timeout = 5 # wait for up to 5 seconds
  11861. </pre></div>
  11862. <div class="sect2" title="12.4.46.&nbsp;ondisk_attrs_default"><div class="titlepage"><div><div><h3 class="title"><a name="conf-ondisk-attrs-default"></a>12.4.46.&nbsp;ondisk_attrs_default</h3></div></div></div>
  11863. <p>
  11864. Instance-wide defaults for <a class="link" href="#conf-ondisk-attrs" title="12.2.68.&nbsp;ondisk_attrs">ondisk_attrs</a>
  11865. directive. Optional, default is 0 (all attributes are loaded in memory). This
  11866. directive lets you specify the default value of ondisk_attrs for all indexes
  11867. served by this copy of searchd. Per-index directives take precedence, and will
  11868. overwrite this instance-wide default value, allowing for fine-grain control.
  11869. </p></div>
  11870. <div class="sect2" title="12.4.47.&nbsp;query_log_min_msec"><div class="titlepage"><div><div><h3 class="title"><a name="conf-query-log-min-msec"></a>12.4.47.&nbsp;query_log_min_msec</h3></div></div></div>
  11871. <p>
  11872. Limit (in milliseconds) that prevents the query from being written to the query log.
  11873. Optional, default is 0 (all queries are written to the query log). This directive
  11874. specifies that only queries with execution times that exceed the specified limit will be logged.
  11875. </p></div>
  11876. <div class="sect2" title="12.4.48.&nbsp;agent_connect_timeout"><div class="titlepage"><div><div><h3 class="title"><a name="conf-agent-connect-timeout-default"></a>12.4.48.&nbsp;agent_connect_timeout</h3></div></div></div>
  11877. <p>
  11878. Instance-wide defaults for <a class="link" href="#conf-agent-connect-timeout" title="12.2.34.&nbsp;agent_connect_timeout">agent_connect_timeout</a> parameter.
  11879. The last defined in distributed (network) indexes.
  11880. </p></div>
  11881. <div class="sect2" title="12.4.49.&nbsp;agent_query_timeout"><div class="titlepage"><div><div><h3 class="title"><a name="conf-agent-query-timeout-default"></a>12.4.49.&nbsp;agent_query_timeout</h3></div></div></div>
  11882. <p>
  11883. Instance-wide defaults for <a class="link" href="#conf-agent-query-timeout" title="12.2.35.&nbsp;agent_query_timeout">agent_query_timeout</a> parameter.
  11884. The last defined in distributed (network) indexes, or also may be overrided per-query using OPTION clause.
  11885. </p></div>
  11886. <div class="sect2" title="12.4.50.&nbsp;agent_retry_count"><div class="titlepage"><div><div><h3 class="title"><a name="conf-agent-retry-count"></a>12.4.50.&nbsp;agent_retry_count</h3></div></div></div>
  11887. <p>
  11888. Integer, specifies how many times sphinx will try to connect and query remote agents in distributed index before reporting
  11889. fatal query error. Default is 0 (i.e. no retries). This value may be also specified on per-query basis using
  11890. 'OPTION retry_count=XXX' clause. If per-query option exists, it will override the one specified in config.
  11891. </p></div>
  11892. <div class="sect2" title="12.4.51.&nbsp;agent_retry_delay"><div class="titlepage"><div><div><h3 class="title"><a name="conf-agent-retry-delay"></a>12.4.51.&nbsp;agent_retry_delay</h3></div></div></div>
  11893. <p>
  11894. Integer, in milliseconds. Specifies the delay sphinx rest before retrying to query a remote agent in case it fails.
  11895. The value has sense only if non-zero <a class="link" href="#conf-agent-retry-count" title="12.4.50.&nbsp;agent_retry_count">agent_retry_count</a>
  11896. or non-zero per-query OPTION retry_count specified. Default is 500. This value may be also specified
  11897. on per-query basis using 'OPTION retry_delay=XXX' clause. If per-query option exists, it will override the one specified in config.
  11898. </p></div></div>
  11899. <div class="sect1" title="12.5.&nbsp;Common section configuration options"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="confgroup-common"></a>12.5.&nbsp;Common section configuration options</h2></div></div></div>
  11900. <div class="sect2" title="12.5.1.&nbsp;lemmatizer_base"><div class="titlepage"><div><div><h3 class="title"><a name="conf-lemmatizer-base"></a>12.5.1.&nbsp;lemmatizer_base</h3></div></div></div>
  11901. <p>
  11902. Lemmatizer dictionaries base path.
  11903. Optional, default is /usr/local/share (as in --datadir switch to ./configure script).
  11904. Added in version 2.1.1-beta.
  11905. </p><p>
  11906. Our lemmatizer implementation (see <a class="xref" href="#conf-morphology" title="12.2.6.&nbsp;morphology">Section&nbsp;12.2.6, &#8220;morphology&#8221;</a> for a discussion
  11907. of what lemmatizers are) is dictionary driven. lemmatizer_base directive configures
  11908. the base dictionary path. File names are hardcoded and specific to a given lemmatizer;
  11909. the Russian lemmatizer uses ru.pak dictionary file. The dictionaries can be obtained
  11910. from the Sphinx website.
  11911. </p><h4><a name="idp34175424"></a>Example:</h4><pre class="programlisting">
  11912. lemmatizer_base = /usr/local/share/sphinx/dicts/
  11913. </pre></div>
  11914. <div class="sect2" title="12.5.2.&nbsp;on_json_attr_error"><div class="titlepage"><div><div><h3 class="title"><a name="conf-on-json-attr-error"></a>12.5.2.&nbsp;on_json_attr_error</h3></div></div></div>
  11915. <p>
  11916. What to do if JSON format errors are found.
  11917. Optional, default value is <code class="option">ignore_attr</code> (ignore errors).
  11918. Applies only to <code class="option">sql_attr_json</code> attributes.
  11919. Added in 2.1.1-beta.
  11920. </p><p>
  11921. By default, JSON format errors are ignored (<code class="option">ignore_attr</code>) and
  11922. the indexer tool will just show a warning. Setting this option to <code class="option">fail_index</code>
  11923. will rather make indexing fail at the first JSON format error.
  11924. </p><h4><a name="idp34180544"></a>Example:</h4><pre class="programlisting">
  11925. on_json_attr_error = ignore_attr
  11926. </pre></div>
  11927. <div class="sect2" title="12.5.3.&nbsp;json_autoconv_numbers"><div class="titlepage"><div><div><h3 class="title"><a name="conf-json-autoconv-numbers"></a>12.5.3.&nbsp;json_autoconv_numbers</h3></div></div></div>
  11928. <p>
  11929. Automatically detect and convert possible JSON
  11930. strings that represent numbers, into numeric attributes.
  11931. Optional, default value is 0 (do not convert strings into numbers).
  11932. Added in 2.1.1-beta.
  11933. </p><p>
  11934. When this option is 1, values such as "1234" will be indexed as numbers instead
  11935. of strings; if the option is 0, such values will be indexed as strings.
  11936. This conversion applies to any data source, that is, JSON attributes originating
  11937. from either SQL or XMLpipe2 sources will all be affected.
  11938. </p><h4><a name="idp34184176"></a>Example:</h4><pre class="programlisting">
  11939. json_autoconv_numbers = 1
  11940. </pre></div>
  11941. <div class="sect2" title="12.5.4.&nbsp;json_autoconv_keynames"><div class="titlepage"><div><div><h3 class="title"><a name="conf-json-autoconv-keynames"></a>12.5.4.&nbsp;json_autoconv_keynames</h3></div></div></div>
  11942. <p>
  11943. Whether and how to auto-convert key names within JSON attributes.
  11944. Known value is 'lowercase'.
  11945. Optional, default value is unspecified (do not convert anything).
  11946. Added in 2.1.1-beta.
  11947. </p><p>
  11948. When this directive is set to 'lowercase', key names within JSON attributes
  11949. will be automatically brought to lower case when indexing.
  11950. This conversion applies to any data source, that is, JSON attributes originating
  11951. from either SQL or XMLpipe2 sources will all be affected.
  11952. </p><h4><a name="idp34187728"></a>Example:</h4><pre class="programlisting">
  11953. json_autoconv_keynames = lowercase
  11954. </pre></div>
  11955. <div class="sect2" title="12.5.5.&nbsp;rlp_root"><div class="titlepage"><div><div><h3 class="title"><a name="conf-rlp-root"></a>12.5.5.&nbsp;rlp_root</h3></div></div></div>
  11956. <p>
  11957. Path to the RLP root folder. Mandatory if RLP is used.
  11958. Added in 2.2.1-beta.
  11959. </p><h4><a name="idp34190384"></a>Example:</h4><pre class="programlisting">
  11960. rlp_root = /home/myuser/RLP
  11961. </pre></div>
  11962. <div class="sect2" title="12.5.6.&nbsp;rlp_environment"><div class="titlepage"><div><div><h3 class="title"><a name="conf-rlp-environment"></a>12.5.6.&nbsp;rlp_environment</h3></div></div></div>
  11963. <p>
  11964. RLP environment configuration file. Mandatory if RLP is used.
  11965. Added in 2.2.1-beta.
  11966. </p><h4><a name="idp34193088"></a>Example:</h4><pre class="programlisting">
  11967. rlp_environment = /home/myuser/RLP/rlp-environment.xml
  11968. </pre></div>
  11969. <div class="sect2" title="12.5.7.&nbsp;rlp_max_batch_size"><div class="titlepage"><div><div><h3 class="title"><a name="conf-rlp-max-batch-size"></a>12.5.7.&nbsp;rlp_max_batch_size</h3></div></div></div>
  11970. <p>
  11971. Maximum total size of documents batched before processing them by the RLP. Optional, default is 51200.
  11972. Do not set this value to more than 10Mb because sphinx splits large documents to 10Mb chunks before processing them by the RLP.
  11973. This option has effect only if <code class="option">morphology = rlp_chinese_batched</code> is specified.
  11974. Added in 2.2.1-beta.
  11975. </p><h4><a name="idp34196480"></a>Example:</h4><pre class="programlisting">
  11976. rlp_max_batch_size = 100k
  11977. </pre></div>
  11978. <div class="sect2" title="12.5.8.&nbsp;rlp_max_batch_docs"><div class="titlepage"><div><div><h3 class="title"><a name="conf-rlp-max-batch-docs"></a>12.5.8.&nbsp;rlp_max_batch_docs</h3></div></div></div>
  11979. <p>
  11980. Maximum number of documents batched before processing them by the RLP. Optional, default is 50.
  11981. This option has effect only if <code class="option">morphology = rlp_chinese_batched</code> is specified.
  11982. Added in 2.2.1-beta.
  11983. </p><h4><a name="idp34199712"></a>Example:</h4><pre class="programlisting">
  11984. rlp_max_batch_docs = 100
  11985. </pre></div></div></div>
  11986. <div class="appendix" title="Appendix&nbsp;A.&nbsp;Sphinx revision history"><div class="titlepage"><div><div><h2 class="title"><a name="changelog"></a>Appendix&nbsp;A.&nbsp;Sphinx revision history</h2></div></div></div>
  11987. <div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#rel226">A.1. Version 2.2.6-release, 13 nov 2014</a></span></dt>
  11988. <dt><span class="sect1"><a href="#rel225">A.2. Version 2.2.5-release, 06 oct 2014</a></span></dt>
  11989. <dt><span class="sect1"><a href="#rel224">A.3. Version 2.2.4-release, 11 sep 2014</a></span></dt>
  11990. <dt><span class="sect1"><a href="#rel223">A.4. Version 2.2.3-beta, 13 may 2014</a></span></dt>
  11991. <dt><span class="sect1"><a href="#rel222">A.5. Version 2.2.2-beta, 11 feb 2014</a></span></dt>
  11992. <dt><span class="sect1"><a href="#rel221">A.6. Version 2.2.1-beta, 13 nov 2013</a></span></dt>
  11993. <dt><span class="sect1"><a href="#rel219">A.7. Version 2.1.9-release, 03 jul 2014</a></span></dt>
  11994. <dt><span class="sect1"><a href="#rel218">A.8. Version 2.1.8-release, 28 apr 2014</a></span></dt>
  11995. <dt><span class="sect1"><a href="#rel217">A.9. Version 2.1.7-release, 30 mar 2014</a></span></dt>
  11996. <dt><span class="sect1"><a href="#rel216">A.10. Version 2.1.6-release, 24 feb 2014</a></span></dt>
  11997. <dt><span class="sect1"><a href="#rel215">A.11. Version 2.1.5-release, 22 jan 2014</a></span></dt>
  11998. <dt><span class="sect1"><a href="#rel214">A.12. Version 2.1.4-release, 18 dec 2013</a></span></dt>
  11999. <dt><span class="sect1"><a href="#rel213">A.13. Version 2.1.3-release, 12 nov 2013</a></span></dt>
  12000. <dt><span class="sect1"><a href="#rel212">A.14. Version 2.1.2-release, 10 oct 2013</a></span></dt>
  12001. <dt><span class="sect1"><a href="#rel211">A.15. Version 2.1.1-beta, 20 feb 2013</a></span></dt>
  12002. <dt><span class="sect1"><a href="#rel2011">A.16. Version 2.0.11-dev, xx xxx xxxx</a></span></dt>
  12003. <dt><span class="sect1"><a href="#rel2010">A.17. Version 2.0.10-release, 22 jan 2014</a></span></dt>
  12004. <dt><span class="sect1"><a href="#rel209">A.18. Version 2.0.9-release, 26 aug 2013</a></span></dt>
  12005. <dt><span class="sect1"><a href="#rel208">A.19. Version 2.0.8-release, 26 apr 2013</a></span></dt>
  12006. <dt><span class="sect1"><a href="#rel207">A.20. Version 2.0.7-release, 26 mar 2013</a></span></dt>
  12007. <dt><span class="sect1"><a href="#rel206">A.21. Version 2.0.6-release, 22 oct 2012</a></span></dt>
  12008. <dt><span class="sect1"><a href="#rel205">A.22. Version 2.0.5-release, 28 jul 2012</a></span></dt>
  12009. <dt><span class="sect1"><a href="#rel204">A.23. Version 2.0.4-release, 02 mar 2012</a></span></dt>
  12010. <dt><span class="sect1"><a href="#rel203">A.24. Version 2.0.3-release, 23 dec 2011</a></span></dt>
  12011. <dt><span class="sect1"><a href="#rel202">A.25. Version 2.0.2-beta, 15 nov 2011</a></span></dt>
  12012. <dt><span class="sect1"><a href="#rel201">A.26. Version 2.0.1-beta, 22 apr 2011</a></span></dt>
  12013. <dt><span class="sect1"><a href="#rel110">A.27. Version 1.10-beta, 19 jul 2010</a></span></dt>
  12014. <dt><span class="sect1"><a href="#rel099">A.28. Version 0.9.9-release, 02 dec 2009</a></span></dt>
  12015. <dt><span class="sect1"><a href="#rel099rc2">A.29. Version 0.9.9-rc2, 08 apr 2009</a></span></dt>
  12016. <dt><span class="sect1"><a href="#rel099rc1">A.30. Version 0.9.9-rc1, 17 nov 2008</a></span></dt>
  12017. <dt><span class="sect1"><a href="#rel0981">A.31. Version 0.9.8.1, 30 oct 2008</a></span></dt>
  12018. <dt><span class="sect1"><a href="#rel098">A.32. Version 0.9.8, 14 jul 2008</a></span></dt>
  12019. <dt><span class="sect1"><a href="#rel097">A.33. Version 0.9.7, 02 apr 2007</a></span></dt>
  12020. <dt><span class="sect1"><a href="#rel097rc2">A.34. Version 0.9.7-rc2, 15 dec 2006</a></span></dt>
  12021. <dt><span class="sect1"><a href="#rel097rc">A.35. Version 0.9.7-rc1, 26 oct 2006</a></span></dt>
  12022. <dt><span class="sect1"><a href="#rel096">A.36. Version 0.9.6, 24 jul 2006</a></span></dt>
  12023. <dt><span class="sect1"><a href="#rel096rc1">A.37. Version 0.9.6-rc1, 26 jun 2006</a></span></dt>
  12024. </dl></div>
  12025. <div class="sect1" title="A.1.&nbsp;Version 2.2.6-release, 13 nov 2014"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel226"></a>A.1.&nbsp;Version 2.2.6-release, 13 nov 2014</h2></div></div></div>
  12026. <h3><a name="idp34204000"></a>Bug fixes</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=2104" target="_top">#2104</a>, <a class="link" href="#expr-func-all">ALL()</a>/ANY()/INDEXOF() support for distributed indexes</p></li>
  12027. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=2102" target="_top">#2102</a>, show agent status misses warnings from agents</p></li>
  12028. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=2100" target="_top">#2100</a>, crash of <code class="filename">indexer</code> while loading stopwords with tokenizer plugin</p></li>
  12029. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=2098" target="_top">#2098</a>, arbitrary JSON subkeys and IS NULL for distributed indexes</p></li>
  12030. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=2097" target="_top">#2097</a>, escaping of field-start modifier</p></li>
  12031. <li class="listitem"><p>fixed possibly memory leak in plugin creation function</p></li>
  12032. <li class="listitem"><p>indexation of duplicate documents</p></li>
  12033. </ul></div></div>
  12034. <div class="sect1" title="A.2.&nbsp;Version 2.2.5-release, 06 oct 2014"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel225"></a>A.2.&nbsp;Version 2.2.5-release, 06 oct 2014</h2></div></div></div>
  12035. <h3><a name="idp34215216"></a>New minor features</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added OPTION <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">rand_seed</a> which affects ORDER BY RAND()</p></li>
  12036. </ul></div>
  12037. <h3><a name="idp34217376"></a>Bug fixes</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=2042" target="_top">#2042</a>, <code class="filename">indextool</code> fails with field mask on 32+ fields</p></li>
  12038. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=2031" target="_top">#2031</a>, wrong encoding with UnixODBC/Oracle source</p></li>
  12039. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=2056" target="_top">#2056</a>, several bugs in RLP tokenizer</p></li>
  12040. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=2054" target="_top">#2054</a>, <a class="link" href="#sphinxql-threads" title="8.39.&nbsp;SHOW THREADS syntax">SHOW THREADS </a>hangs if queries in prefork mode</p></li>
  12041. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=2057" target="_top">#2057</a>, WARNING at <code class="filename">indexer</code> on duplicated wordforms</p></li>
  12042. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=2066" target="_top">#2066</a>, snippet generation with <a class="link" href="#api-func-buildexcerpts" title="9.7.1.&nbsp;BuildExcerpts">weight_order</a> enabled</p></li>
  12043. <li class="listitem"><p>fixed exception parsing in queries</p></li>
  12044. <li class="listitem"><p>fixed crash in config parser</p></li>
  12045. <li class="listitem"><p>fixed MySQL protocol response when daemon maxed out</p></li>
  12046. </ul></div></div>
  12047. <div class="sect1" title="A.3.&nbsp;Version 2.2.4-release, 11 sep 2014"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel224"></a>A.3.&nbsp;Version 2.2.4-release, 11 sep 2014</h2></div></div></div>
  12048. <h3><a name="idp34232064"></a>New major features</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added <a class="link" href="#sphinxql-attach" title="8.24.&nbsp;ALTER syntax">ALTER</a> RTINDEX rt1 RECONFIGURE which allows to change RT index settings on the fly</p></li>
  12049. <li class="listitem"><p>added <a class="link" href="#sphinxql-show-index-settings" title="8.32.&nbsp;SHOW INDEX SETTINGS syntax">SHOW INDEX idx1 SETTINGS</a> statement</p></li>
  12050. <li class="listitem"><p>added ability to specify several destination forms for the same source wordform (as a result, N:M mapping is now available)</p></li>
  12051. <li class="listitem"><p>added blended chars support to exceptions</p></li>
  12052. </ul></div>
  12053. <h3><a name="idp34237184"></a>New minor features</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added <a class="link" href="#expr-func-any">ANY()</a>/<a class="link" href="#expr-func-all">ALL()</a>/<a class="link" href="#expr-func-indexof">INDEXOF()</a> support for JSON string arrays</p></li>
  12054. <li class="listitem"><p>added FACTORS() alias for <a class="link" href="#expr-func-packedfactors">PACKEDFACTORS()</a> function</p></li>
  12055. <li class="listitem"><p>added <code class="code">LIMIT</code> clause for the <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">FACET</a> keyword</p></li>
  12056. <li class="listitem"><p>added JSON-formatted output to <code class="code">PACKEDFACTORS()</code> function</p></li>
  12057. <li class="listitem"><p>added #1999 <a class="link" href="#expr-func-atan2">ATAN2()</a> function</p></li>
  12058. <li class="listitem"><p>added connections counter and also avg and max timers to agent status</p></li>
  12059. <li class="listitem"><p>added <code class="filename">searchd</code> configuration keys <a class="link" href="#conf-agent-connect-timeout" title="12.2.34.&nbsp;agent_connect_timeout">agent_connect_timeout</a>, <a class="link" href="#conf-agent-query-timeout" title="12.2.35.&nbsp;agent_query_timeout">agent_query_timeout</a>, <a class="link" href="#conf-agent-retry-count" title="12.4.50.&nbsp;agent_retry_count">agent_retry_count</a> and <a class="link" href="#conf-agent-retry-delay" title="12.4.51.&nbsp;agent_retry_delay">agent_retry_delay</a></p></li>
  12060. <li class="listitem"><p><a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">GROUPBY()</a> function now returns strings for string attributes</p></li>
  12061. </ul></div>
  12062. <h3><a name="idp34252912"></a>Optimizations and removals</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>optimized <a class="link" href="#conf-json-autoconv-numbers" title="12.5.3.&nbsp;json_autoconv_numbers">json_autoconv_numbers</a> option speed</p></li>
  12063. <li class="listitem"><p>optimized tokenizing with expections on</p></li>
  12064. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1970" target="_top">#1970</a>, speeding up <a class="link" href="#extended-syntax" title="5.3.&nbsp;Extended query syntax">ZONE and ZONESPAN</a> operators</p></li>
  12065. </ul></div>
  12066. <h3><a name="idp34257888"></a>Bug fixes</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=2027" target="_top">#2027</a>, slow queries to multiple indexes with large kill-lists</p></li>
  12067. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=2022" target="_top">#2022</a>, blend characters of matched word must not be outside of snippet passage</p></li>
  12068. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=2021" target="_top">#2021</a>, output units in <a class="link" href="#expr-func-geodist">GEODIST()</a> function</p></li>
  12069. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=2018" target="_top">#2018</a>, different wildcard behaviour in RT and plain indexes</p></li>
  12070. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=2005" target="_top">#2005</a>, aggregate functions improperly calculate aliased expressions</p></li>
  12071. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1972" target="_top">#1972</a>, daemon crashes trying to read a big (&gt;8G) .spm file</p></li>
  12072. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1966" target="_top">#1966</a>, <a class="link" href="#expr-func-interval">INTERVAL()</a> function does not work with JSON fields</p></li>
  12073. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1963" target="_top">#1963</a>, <code class="code">GROUPBY()</code> on JSON attributes sometimes yields NULL</p></li>
  12074. <li class="listitem"><p>fixed <code class="code">GROUPBY()</code> on empty JSON arrays to return NULL instead of []</p></li>
  12075. <li class="listitem"><p>fixed buffer overrun when sizing packed factors (with way too many fields) in expression ranker</p></li>
  12076. <li class="listitem"><p>fixed cpu time logging for cases where work is done in child threads or agents</p></li>
  12077. </ul></div></div>
  12078. <div class="sect1" title="A.4.&nbsp;Version 2.2.3-beta, 13 may 2014"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel223"></a>A.4.&nbsp;Version 2.2.3-beta, 13 may 2014</h2></div></div></div>
  12079. <h3><a name="idp34274848"></a>New features</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1920" target="_top">#1920</a>, <a class="link" href="#conf-charset-table" title="12.2.16.&nbsp;charset_table">charset_table</a> aliases</p></li>
  12080. <li class="listitem"><p>added <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1887" target="_top">#1887</a>, filtering over string attributes</p></li>
  12081. <li class="listitem"><p>added <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1860" target="_top">#1860</a>, <a class="link" href="#sphinxql-set" title="8.9.&nbsp;SET syntax">USERVARs</a> for distributed indexes</p></li>
  12082. <li class="listitem"><p>added <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1689" target="_top">#1689</a>, <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">GROUP BY JSON</a> attributes</p></li>
  12083. <li class="listitem"><p>added <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">FACET</a> keyword</p></li>
  12084. <li class="listitem"><p>added Go MySQL connector support</p></li>
  12085. <li class="listitem"><p>added <a class="link" href="#extended-syntax" title="5.3.&nbsp;Extended query syntax">IDF boost</a> keyword modifier</p></li>
  12086. <li class="listitem"><p>added <a class="link" href="#extended-syntax" title="5.3.&nbsp;Extended query syntax">MAYBE</a> fulltext operator</p></li>
  12087. </ul></div>
  12088. <h3><a name="idp34287920"></a>Optimizations and removals</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>improved speed of concurrent insertion in RT indexes</p></li>
  12089. <li class="listitem"><p>removed <a class="link" href="#sphinx-deprecations-defaults" title="2.6.&nbsp;Sphinx deprecations and changes in default configuration">max_matches</a> config key</p></li>
  12090. </ul></div>
  12091. <h3><a name="idp34290832"></a>Bug fixes</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1946" target="_top">#1946</a>, <a class="link" href="#expr-func-in">IN()</a> function support for string attributes</p></li>
  12092. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1942" target="_top">#1942</a>, crash in <a class="link" href="#sphinxql-threads" title="8.39.&nbsp;SHOW THREADS syntax">SHOW THREADS</a> command</p></li>
  12093. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1922" target="_top">#1922</a>, crash on snippet generation for queries with duplicated words</p></li>
  12094. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1919" target="_top">#1919</a>, <a class="link" href="#tsvpipe" title="3.10.&nbsp;tsvpipe (Tab Separated Values) data source">TSV</a> bitcount attributes indexation issue</p></li>
  12095. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1916" target="_top">#1916</a>, <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">COUNT(*)</a> with empty result set</p></li>
  12096. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1910" target="_top">#1910</a>, JSON parsing issue</p></li>
  12097. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1906" target="_top">#1906</a>, <a class="link" href="#extended-syntax" title="5.3.&nbsp;Extended query syntax">ZONE</a> constraints for expanded terms</p></li>
  12098. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1904" target="_top">#1904</a>, race condition in RT indexes on saving disk chunk</p></li>
  12099. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1899" target="_top">#1899</a>, crash on <a class="link" href="#sphinxql-call-keywords" title="8.15.&nbsp;CALL KEYWORDS syntax">CALL KEYWORDS</a></p></li>
  12100. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1893" target="_top">#1893</a>, <code class="filename">searchd</code> crashes on expressions like 'a&lt;&lt;(*!b)'</p></li>
  12101. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1884" target="_top">#1884</a>, crash with <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">SNIPPET()</a> function over distributed index</p></li>
  12102. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1883" target="_top">#1883</a>, crash at expanded keyword with hitless index</p></li>
  12103. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1870" target="_top">#1870</a>, crash on <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">ORDER BY JSON</a> attributes</p></li>
  12104. <li class="listitem"><p>fixed template index removing on rotation</p></li>
  12105. </ul></div></div>
  12106. <div class="sect1" title="A.5.&nbsp;Version 2.2.2-beta, 11 feb 2014"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel222"></a>A.5.&nbsp;Version 2.2.2-beta, 11 feb 2014</h2></div></div></div>
  12107. <h3><a name="idp34317632"></a>New features</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added #1604, <a class="link" href="#sphinxql-call-keywords" title="8.15.&nbsp;CALL KEYWORDS syntax">CALL KEYWORDS</a> can show now multiple lemmas for a keyword</p></li>
  12108. <li class="listitem"><p>added <a class="link" href="#sphinxql-attach" title="8.24.&nbsp;ALTER syntax">ALTER TABLE DROP COLUMN</a></p></li>
  12109. <li class="listitem"><p>added ALTER for JSON/string/MVA attributes</p></li>
  12110. <li class="listitem"><p>added <a class="link" href="#expr-func-remap">REMAP()</a> function which surpasses SetOverride() API</p></li>
  12111. <li class="listitem"><p>added an argument to <a class="link" href="#misc-functions" title="5.5.6.&nbsp;Miscellaneous functions">PACKEDFACTORS()</a> to disable ATC calculation (syntax: PACKEDFACTORS({no_atc=1}))</p></li>
  12112. <li class="listitem"><p>added exact phrase query syntax</p></li>
  12113. <li class="listitem"><p>added flag <code class="option">'--enable-dl'</code> to configure script which works with <code class="filename">libmysqlclient</code>, <code class="filename">libpostgresql</code>, <code class="filename">libexpat</code>, <code class="filename">libunixobdc</code></p></li>
  12114. <li class="listitem"><p>added new plugin system: <a class="link" href="#sphinxql-create-plugin" title="8.36.&nbsp;CREATE PLUGIN syntax">CREATE</a>/<a class="link" href="#sphinxql-drop-plugin" title="8.37.&nbsp;DROP PLUGIN syntax">DROP PLUGIN</a>, <a class="link" href="#sphinxql-show-plugins" title="8.38.&nbsp;SHOW PLUGINS syntax">SHOW PLUGINS</a>, <a class="link" href="#conf-plugin-dir" title="12.4.31.&nbsp;plugin_dir">plugin_dir</a> now in common, <a class="link" href="#sphinxql-create-plugin" title="8.36.&nbsp;CREATE PLUGIN syntax">index/query_token_filter</a> plugins</p></li>
  12115. <li class="listitem"><p>added <a class="link" href="#conf-ondisk-attrs" title="12.2.68.&nbsp;ondisk_attrs">ondisk_attrs</a> support for RT indexes</p></li>
  12116. <li class="listitem"><p>added position shift operator to phrase operator</p></li>
  12117. <li class="listitem"><p>added possibility to add user-defined rankers (via <a class="link" href="#extending-sphinx" title="Chapter&nbsp;6.&nbsp;Extending Sphinx">plugins</a>)</p></li>
  12118. </ul></div>
  12119. <h3><a name="idp34337104"></a>Optimizations, behavior changes, and removals</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>changed #1797, per-term statistics report (expanded terms fold to their respective substrings)</p></li>
  12120. <li class="listitem"><p>changed default <a class="link" href="#conf-thread-stack" title="12.4.34.&nbsp;thread_stack">thread_stack</a> value to 1M</p></li>
  12121. <li class="listitem"><p>changed local directive in a distributed index which takes now a list (eg. <code class="option">local=shard1,shard2,shard3</code>)</p></li>
  12122. <li class="listitem"><p>deprecated <a class="link" href="#api-func-setmatchmode" title="9.3.1.&nbsp;SetMatchMode">SetMatchMode()</a> API call</p></li>
  12123. <li class="listitem"><p>deprecated <a class="link" href="#api-func-setoverride" title="9.2.3.&nbsp;SetOverride">SetOverride()</a> API call</p></li>
  12124. <li class="listitem"><p>optimized infix searches for dict=keywords</p></li>
  12125. <li class="listitem"><p>optimized kill lists in plain and RT indexes</p></li>
  12126. <li class="listitem"><p>removed deprecated <code class="option">"address"</code> and <code class="option">"port"</code> config keys</p></li>
  12127. <li class="listitem"><p>removed deprecated CLI <code class="filename">search</code> and <code class="option">sql_query_info</code></p></li>
  12128. <li class="listitem"><p>removed deprecated <code class="option">charset_type</code> and <code class="option">mssql_unicode</code></p></li>
  12129. <li class="listitem"><p>removed deprecated <code class="option">enable_star</code></p></li>
  12130. <li class="listitem"><p>removed deprecated <code class="option">ondisk_dict</code> and <code class="option">ondisk_dict_default</code></p></li>
  12131. <li class="listitem"><p>removed deprecated <code class="option">str2ordinal</code> attributes</p></li>
  12132. <li class="listitem"><p>removed deprecated <code class="option">str2wordcount</code> attributes</p></li>
  12133. <li class="listitem"><p>removed support for client versions 0.9.6 and below</p></li>
  12134. </ul></div></div>
  12135. <div class="sect1" title="A.6.&nbsp;Version 2.2.1-beta, 13 nov 2013"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel221"></a>A.6.&nbsp;Version 2.2.1-beta, 13 nov 2013</h2></div></div></div>
  12136. <h3><a name="idp34355216"></a>Major new features</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">added <a class="link" href="#sphinxql-attach" title="8.24.&nbsp;ALTER syntax">ALTER TABLE</a> that can add attributes to disk and RT indexes on the fly</li>
  12137. <li class="listitem">added ATTACH support for non-empty RT target indexes</li>
  12138. <li class="listitem">added Chinese segmentation with <a class="link" href="#conf-morphology" title="12.2.6.&nbsp;morphology">RLP</a> (Rosette Linguistics platform) support</li>
  12139. <li class="listitem">added English, German <a class="link" href="#conf-morphology" title="12.2.6.&nbsp;morphology">lemmatization</a> support</li>
  12140. <li class="listitem">added <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">HAVING</a> support to SELECT statement, filtering on aggregate values is now possible</li>
  12141. <li class="listitem">added <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">N-best GROUP BY</a> extension to return more than 1 row per group</li>
  12142. <li class="listitem">added RT index support for <a class="link" href="#conf-index-field-lengths" title="12.2.63.&nbsp;index_field_lengths">index_field_lengths=1</a>, bitfield attributes, and multiforms</li>
  12143. <li class="listitem">added CSV, <a class="link" href="#tsvpipe" title="3.10.&nbsp;tsvpipe (Tab Separated Values) data source">TSV</a> data sources</li>
  12144. <li class="listitem">added full <a class="link" href="#conf-sql-attr-json" title="12.1.24.&nbsp;sql_attr_json">JSON</a> attributes support, arbitrary JSON documents (with subobjects etc) can now be stored</li>
  12145. <li class="listitem">added in-place JSON updates for scalar values</li>
  12146. <li class="listitem">added index <a class="link" href="#conf-index-type" title="12.2.1.&nbsp;type">type=template</a> directive (allows CALL KEYWORDS, CALL SNIPPETS)</li>
  12147. <li class="listitem">added <a class="link" href="#conf-ondisk-attrs" title="12.2.68.&nbsp;ondisk_attrs">ondisk_attrs</a>, <a class="link" href="#conf-ondisk-attrs-default" title="12.4.46.&nbsp;ondisk_attrs_default">ondisk_attrs_default</a> directives that keep attributes on disk</li>
  12148. <li class="listitem">added table functions mechanism, and <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">REMOVE_REPEATS()</a> table function</li>
  12149. <li class="listitem">added support for arbitrary expressions in WHERE for DELETE queries</li>
  12150. </ul></div>
  12151. <h3><a name="idp34372400"></a>Ranking related features</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">added OPTION <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">local_df=1</a>, an option to aggregate IDFs over local indexes (shards)</li>
  12152. <li class="listitem">added <a class="link" href="#sphinx-udfs" title="6.1.&nbsp;Sphinx UDFs (User Defined Functions)">UDF</a> XXX_reinit() method to reload UDFs with <code class="option">workers=prefork</code></li>
  12153. <li class="listitem">added comma-separated syntax to <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">OPTION</a><code class="option"> idf</code>, <code class="option">tfidf_unnormalized</code> and <code class="option">tfidf_normalized</code> flags</li>
  12154. <li class="listitem">added <code class="option">lccs</code>, <code class="option">wlccs</code>, <code class="option">exact_order</code>, <code class="option">min_gaps</code>, and <code class="option">atc </code><a class="link" href="#field-factors" title="5.4.6.&nbsp;Field-level ranking factors">ranking factors</a></li>
  12155. <li class="listitem">added <code class="code">sphinx_get_XXX_factors()</code>, a faster interface to access <a class="link" href="#misc-functions" title="5.5.6.&nbsp;Miscellaneous functions">PACKEDFACTORS()</a> in UDFs</li>
  12156. <li class="listitem">added support for <a class="link" href="#field-factors" title="5.4.6.&nbsp;Field-level ranking factors">exact_hit</a>, <a class="link" href="#field-factors" title="5.4.6.&nbsp;Field-level ranking factors">exact_order</a> field factors when using more than 32 fields (exact_hit, exact_order)</li>
  12157. </ul></div>
  12158. <h3><a name="idp34385680"></a>Instrumentation features</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">added <a class="link" href="#sphinxql-describe" title="8.17.&nbsp;DESCRIBE syntax">DESCRIBE</a> and <a class="link" href="#ref-indextool" title="7.4.&nbsp;indextool command reference">--dumpheader</a> support for tokencount attributes (generated by index_field_lengths=1 directive)</li>
  12159. <li class="listitem">added RT index query profile, percentages, totals to <a class="link" href="#sphinxql-show-profile" title="8.30.&nbsp;SHOW PROFILE syntax">SHOW PROFILE</a></li>
  12160. <li class="listitem">added <code class="option">predicted_time</code>, <code class="option">dist_predicted_time</code>, <code class="option">fetched_docs</code>, <code class="option">fetched_hits</code> counters to <a class="link" href="#sphinxql-show-meta" title="8.3.&nbsp;SHOW META syntax">SHOW META</a></li>
  12161. <li class="listitem">added <code class="option">total_tokens</code> and <code class="option">disk_bytes</code> counters to <a class="link" href="#sphinxql-show-index-status" title="8.31.&nbsp;SHOW INDEX STATUS syntax">SHOW INDEX STATUS</a></li>
  12162. </ul></div>
  12163. <h3><a name="idp34394928"></a>General features</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">added <a class="link" href="#expr-func-all">ALL()</a>, <a class="link" href="#expr-func-any">ANY()</a> and <a class="link" href="#expr-func-indexof">INDEXOF()</a> functions for JSON subarrays</li>
  12164. <li class="listitem">added <a class="link" href="#expr-func-min-top-weight">MIN_TOP_WEIGHT()</a>, <a class="link" href="#expr-func-min-top-sortval">MIN_TOP_SORTVAL()</a> functions</li>
  12165. <li class="listitem">added <a class="link" href="#factor-aggr-functions" title="5.4.7.&nbsp;Ranking factor aggregation functions">TOP()</a> aggregate function to expression ranker</li>
  12166. <li class="listitem">added a check for duplicated tail hit positions in <a class="link" href="#ref-indextool" title="7.4.&nbsp;indextool command reference">indextool --check</a></li>
  12167. <li class="listitem">added <a class="link" href="#sphinxql-log-format" title="5.9.2.&nbsp;SphinxQL log format">compact_in</a> option to <a class="link" href="#conf-query-log-format" title="12.4.4.&nbsp;query_log_format">query_log_format=sphinxql</a></li>
  12168. <li class="listitem">added distance units and calculation method options to <a class="link" href="#expr-func-geodist">GEODIST()</a> function, optimized it a lot</li>
  12169. <li class="listitem">added embedded stopwords/exceptions/wordforms to <code class="option">--dumpheader</code></li>
  12170. <li class="listitem">added <a class="link" href="#ref-indexer" title="7.1.&nbsp;indexer command reference">indexer --nohup</a> and <a class="link" href="#ref-indextool" title="7.4.&nbsp;indextool command reference">indextool --rotate</a> switches to check index files before rotating them</li>
  12171. <li class="listitem">added scientific notation support for JSON attributes (as per <a class="ulink" href="http://www.ietf.org/rfc/rfc4627.txt" target="_top">RFC 4627</a>)</li>
  12172. <li class="listitem">added several SphinxQL statements to fix MySQL Workbench connection issues (LIKE for session variables, etc.)</li>
  12173. <li class="listitem">added <a class="link" href="#conf-shutdown-timeout" title="12.4.45.&nbsp;shutdown_timeout">shutdown_timeout</a> directive to <code class="filename">searchd</code> config section</li>
  12174. <li class="listitem">added signed values support for <a class="link" href="#expr-func-integer">INTEGER()</a> and <a class="link" href="#expr-func-uint">UINT()</a> function</li>
  12175. <li class="listitem">added snippet generation options to <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">SNIPPET()</a> function</li>
  12176. <li class="listitem">added string filter support in distributed queries, SphinxAPI, SphinxQL query log</li>
  12177. <li class="listitem">added support for mixed distributed and local index queries (SELECT * FROM dist1,dist2,local3), and <code class="option">index_weights</code> option for that case</li>
  12178. </ul></div>
  12179. <h3><a name="idp34417920"></a>Optimizations, behavior changes, and removals</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">optimized JSON attributes access (1.12x to 2.0x+ total query speedup depending on the JSON data)</li>
  12180. <li class="listitem">optimized SELECT (1.02x to 3.5x speedup, depending on index schema size)</li>
  12181. <li class="listitem">optimized <a class="link" href="#sphinxql-update" title="8.23.&nbsp;UPDATE syntax">UPDATE</a> (up to 3x faster on big updates)</li>
  12182. <li class="listitem">optimized away internal threads table mutex contention with <code class="option">workers=threads</code> and 1000s of threads</li>
  12183. <li class="listitem">changed [emptyword -foo] query behavior in cases when emptyword is a stopword or an overshort word, made such queries computable rather than erroneous</li>
  12184. <li class="listitem">changed post-morphology <a class="link" href="#conf-wordforms" title="12.2.12.&nbsp;wordforms">wordforms</a> behavior, now it works as <code class="code">'if ( stem(token)==stem(abc) ) emit(def)'</code></li>
  12185. <li class="listitem">changed the <a class="link" href="#sphinx-deprecations-defaults" title="2.6.&nbsp;Sphinx deprecations and changes in default configuration">config defaults</a> to <code class="option">id64</code>, <code class="option">dict=keywords</code>, <code class="option">charset_type=utf-8</code>, <code class="option">enable_star=1</code>, <code class="option">workers=threads</code>, <code class="option">mem_limit=128M</code>, <code class="option">rt_mem_limit=128M</code></li>
  12186. <li class="listitem">changed the default SphinxAPI matching mode to <a class="link" href="#matching-modes" title="5.1.&nbsp;Matching modes">SPH_MATCH_EXTENDED2</a></li>
  12187. <li class="listitem">disallowed dashes in index names in API requests (just like in SphinxQL)</li>
  12188. <li class="listitem">removed legacy <code class="option">xmlpipe</code> data source v1, <code class="option">compat_sphinxql_magics</code> directive, <code class="option">SetWeights()</code> SphinxAPI call, and SPH_SORT_CUSTOM SphinxAPI mode</li>
  12189. </ul></div>
  12190. <h3><a name="idp34431632"></a>Bug fixes</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1734" target="_top">#1734</a>, unquoted literal in json subscript could cause a crash, returns 'unknown column' now.</li>
  12191. <li class="listitem">fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1683" target="_top">#1683</a>, under certain conditions <a class="link" href="#conf-stopwords" title="12.2.11.&nbsp;stopwords">stopwords</a> were not taken into account in RT indexes</li>
  12192. <li class="listitem">fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1648" target="_top">#1648</a>, #1644, when using AOT lemmas with snippet generation, not all the forms got highlighted</li>
  12193. <li class="listitem">fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1549" target="_top">#1549</a>, <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">OPTION</a><code class="option">idf=tfidf_normalized</code> was ignored for distributed queries</li>
  12194. <li class="listitem">fixed that <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">ORDER BY RAND()</a> was not affected by <code class="option">index_weights</code></li>
  12195. <li class="listitem">fixed that float updates with integer values in SphinxQL mistakenly set the float to 0</li>
  12196. <li class="listitem">fixed that <code class="option">predicted_time</code> was not accumulated with <a class="link" href="#conf-dist-threads" title="12.4.24.&nbsp;dist_threads">dist_threads</a></li>
  12197. <li class="listitem">fixed <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">GROUP_CONCAT</a> result length limit (was implicitly limited by 1024 bytes)</li>
  12198. <li class="listitem">fixed agent query distribution in HA mirroring</li>
  12199. <li class="listitem">fixed duplicates check for <a class="link" href="#extended-syntax" title="5.3.&nbsp;Extended query syntax">quorum operator</a>, it works ok now for expanded keywords</li>
  12200. <li class="listitem">fixed off-by-1 query positions of words in indexes with wordforms and <a class="link" href="#extended-syntax" title="5.3.&nbsp;Extended query syntax">blended characters</a></li>
  12201. <li class="listitem">fixed wrong <code class="option">lcs</code> and <a class="link" href="#field-factors" title="5.4.6.&nbsp;Field-level ranking factors">min_best_span_pos</a> ranking factor values when any expansion (<a class="link" href="#conf-expand-keywords" title="12.2.46.&nbsp;expand_keywords">expand_keywords</a> or lemmatize) occurred</li>
  12202. <li class="listitem">fixed a crash while creating indexes with <a class="link" href="#conf-sql-joined-field" title="12.1.13.&nbsp;sql_joined_field">sql_joined_field</a></li>
  12203. </ul></div></div>
  12204. <div class="sect1" title="A.7.&nbsp;Version 2.1.9-release, 03 jul 2014"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel219"></a>A.7.&nbsp;Version 2.1.9-release, 03 jul 2014</h2></div></div></div>
  12205. <h3><a name="idp34452080"></a>Bug fixes</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1994" target="_top">#1994</a>, parsing of empty JSON arrays</p></li>
  12206. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1987" target="_top">#1987</a>, handling of <a class="link" href="#conf-index-exact-words" title="12.2.42.&nbsp;index_exact_words">index_exact_words</a> with AOT morphology and infixes on</p></li>
  12207. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1984" target="_top">#1984</a>, teaching HTML parser to handle hex numbers</p></li>
  12208. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1983" target="_top">#1983</a>, master and agents networking issue</p></li>
  12209. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1977" target="_top">#1977</a>, escaping of characters doens't work with exceptions</p></li>
  12210. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1968" target="_top">#1968</a>, parsing of <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">WEIGHT()</a> function (queries to distributed indexes affected)</p></li>
  12211. </ul></div></div>
  12212. <div class="sect1" title="A.8.&nbsp;Version 2.1.8-release, 28 apr 2014"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel218"></a>A.8.&nbsp;Version 2.1.8-release, 28 apr 2014</h2></div></div></div>
  12213. <h3><a name="idp34463728"></a>Bug fixes</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1937" target="_top">#1937</a>, crash at <a class="link" href="#extended-syntax" title="5.3.&nbsp;Extended query syntax">SENTENCE</a> operator</p></li>
  12214. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1933" target="_top">#1933</a>, quorum operator works incorrectly if it's number is exception</p></li>
  12215. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1932" target="_top">#1932</a>, fixed daemon index recovery after failed rotation</p></li>
  12216. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1923" target="_top">#1923</a>, crash at <code class="filename">indexer</code> with <code class="option">dict=keywords</code></p></li>
  12217. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1918" target="_top">#1918</a>, fixed crash while hitless words are used within fulltext operators which require hits</p></li>
  12218. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1878" target="_top">#1878</a>, daemon doesn't reset <a class="link" href="#conf-regexp-filter" title="12.2.64.&nbsp;regexp_filter">regexp_filter</a> after rotation with <a class="link" href="#conf-seamless-rotate" title="12.4.9.&nbsp;seamless_rotate">seamless_rotate=0</a></p></li>
  12219. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1769" target="_top">#1769</a>, crash after unsuccessful <a class="link" href="#sphinxql-insert" title="8.6.&nbsp;INSERT and REPLACE syntax">INSERT</a> at RT index</p></li>
  12220. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1682" target="_top">#1682</a>, field end modifier doesn't work with words containing blended chars</p></li>
  12221. </ul></div></div>
  12222. <div class="sect1" title="A.9.&nbsp;Version 2.1.7-release, 30 mar 2014"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel217"></a>A.9.&nbsp;Version 2.1.7-release, 30 mar 2014</h2></div></div></div>
  12223. <h3><a name="idp34480576"></a>Bug fixes</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1917" target="_top">#1917</a>, field limit propagation outside of group</p></li>
  12224. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1915" target="_top">#1915</a>, exact form passes to index skipping stopwords filter</p></li>
  12225. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1905" target="_top">#1905</a>, multiple lemmas at the end of a field</p></li>
  12226. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1903" target="_top">#1903</a>, <code class="filename">indextool</code> check mode for hitless indexes and indexes with large amount of documents</p></li>
  12227. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1902" target="_top">#1902</a>, crash on JSON field in the <a class="link" href="#expr-func-in">IN()</a> function</p></li>
  12228. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1884" target="_top">#1884</a>, crash at <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">SNIPPET()</a> with local indexes at distributed index</p></li>
  12229. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1802" target="_top">#1802</a>, loading large keywords dictionary</p></li>
  12230. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1786" target="_top">#1786</a>, <code class="filename">indextool</code> fails to handle indexes with AOT morphology</p></li>
  12231. <li class="listitem"><p>fixed crash of daemon on logging extra large message</p></li>
  12232. <li class="listitem"><p>fixed expression engine: division by zero, log and sqrt() functions of non-positive arguments</p></li>
  12233. <li class="listitem"><p>fixed LCS and min_best_span_pos computation</p></li>
  12234. <li class="listitem"><p>fixed unnecessary escaping in JSON result set</p></li>
  12235. <li class="listitem"><p>fixed Quick Tour documentation chapter</p></li>
  12236. </ul></div></div>
  12237. <div class="sect1" title="A.10.&nbsp;Version 2.1.6-release, 24 feb 2014"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel216"></a>A.10.&nbsp;Version 2.1.6-release, 24 feb 2014</h2></div></div></div>
  12238. <h3><a name="idp34499040"></a>Bug fixes</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1857" target="_top">#1857</a>, crash in arabic stemmer</p></li>
  12239. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1875" target="_top">#1875</a>, fixed crash on adding documents with long words in dict=keyword index with morphology and infixes enabled</p></li>
  12240. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1876" target="_top">#1876</a>, crash on words with large codepoints and infix searches</p></li>
  12241. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1880" target="_top">#1880</a>, crash on multiquery with one incorrect query</p></li>
  12242. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1882" target="_top">#1882</a>, race of periodic and forced FLUSHing on an RT index</p></li>
  12243. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1881" target="_top">#1881</a>, quorum syntax with '.' as blended char</p></li>
  12244. <li class="listitem"><p>fixed evaluating of LCS by an expression ranker</p></li>
  12245. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1864" target="_top">#1864</a>, <code class="filename">indexer</code> crash on badly formed JSON, e.g. '[,1,2,3,4,]'</p></li>
  12246. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1853" target="_top">#1853</a>, incomplete <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">ORDER BY JSON</a> attribute in distributed indexes</p></li>
  12247. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1847" target="_top">#1847</a>, broken infix searches in RT indexes</p></li>
  12248. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1844" target="_top">#1844</a>, clash of mix cased attribute and field names at CSV source</p></li>
  12249. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1840" target="_top">#1840</a>, filter by <a class="link" href="#sphinxql-set" title="8.9.&nbsp;SET syntax">@uservar</a> in distributes indexes</p></li>
  12250. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1832" target="_top">#1832</a>,#1833,#1834, some big endianess issues</p></li>
  12251. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1830" target="_top">#1830</a>, loss of <a class="link" href="#conf-ondisk-attrs" title="12.2.68.&nbsp;ondisk_attrs">ondisk_attrs</a> after rotation</p></li>
  12252. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1762" target="_top">#1762</a>, memory leak in <a class="link" href="#conf-regexp-filter" title="12.2.64.&nbsp;regexp_filter">regexp_filter</a></p></li>
  12253. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1759" target="_top">#1759</a>, <code class="filename">indextool</code> false positives on persistent MVA checking</p></li>
  12254. <li class="listitem"><p>fixed <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">GROUP BY</a> id</p></li>
  12255. <li class="listitem"><p>fixed crash on sending empty snippet result</p></li>
  12256. <li class="listitem"><p>fixed index corruption in <a class="link" href="#sphinxql-update" title="8.23.&nbsp;UPDATE syntax">UPDATE</a> queries with non-existent attributes</p></li>
  12257. </ul></div></div>
  12258. <div class="sect1" title="A.11.&nbsp;Version 2.1.5-release, 22 jan 2014"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel215"></a>A.11.&nbsp;Version 2.1.5-release, 22 jan 2014</h2></div></div></div>
  12259. <h3><a name="idp34529312"></a>Bug fixes</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1848" target="_top">#1848</a>, infixes and morphology clash</p></li>
  12260. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1823" target="_top">#1823</a>, <code class="filename">indextool</code> fails to handle indexes with lemmatizer morphology</p></li>
  12261. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1799" target="_top">#1799</a>, crash in queries to distributed indexes with <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">GROUP BY</a> on multiple values</p></li>
  12262. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1718" target="_top">#1718</a>, <code class="option">expand_keywords</code> option lost in disk chunks of RT indexes</p></li>
  12263. <li class="listitem"><p>fixed documentation on <a class="link" href="#conf-rt-flush-period" title="12.4.33.&nbsp;rt_flush_period">rt_flush_period</a></p></li>
  12264. <li class="listitem"><p>fixed network protocol issue which results in timeouts of <code class="filename">libmysqlclient</code> for big Sphinx responses</p></li>
  12265. </ul></div></div>
  12266. <div class="sect1" title="A.12.&nbsp;Version 2.1.4-release, 18 dec 2013"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel214"></a>A.12.&nbsp;Version 2.1.4-release, 18 dec 2013</h2></div></div></div>
  12267. <h3><a name="idp34541056"></a>Bug fixes</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1778" target="_top">#1778</a>, indexes with more than 255 attributes</p></li>
  12268. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1777" target="_top">#1777</a>, <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">ORDER BY WEIGHT()</a></p></li>
  12269. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1796" target="_top">#1796</a>, missing results in queries with quorum operator of indexes with some lemmatizer</p></li>
  12270. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1780" target="_top">#1780</a>, incorrect results while querying indexes with wordforms, some lemmatizer and enable_star=1</p></li>
  12271. <li class="listitem"><p>fixed, SHOW PROFILE for fullscan queries</p></li>
  12272. <li class="listitem"><p>fixed, --with-re2 check</p></li>
  12273. </ul></div></div>
  12274. <div class="sect1" title="A.13.&nbsp;Version 2.1.3-release, 12 nov 2013"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel213"></a>A.13.&nbsp;Version 2.1.3-release, 12 nov 2013</h2></div></div></div>
  12275. <h3><a name="idp34550080"></a>Bug fixes</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1753" target="_top">#1753</a>, path to re2 sources could not be set using <code class="option">--with-re2</code>, options <code class="option">--with-re2-libs</code> and <code class="option">--with-re2-includes</code> added to <code class="filename">configure</code></p></li>
  12276. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1739" target="_top">#1739</a>, erroneous conversion of RAM chunk into disk chunk when loading id32 index with id64 binary</p></li>
  12277. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1738" target="_top">#1738</a>, unlinking RAM chunk when converting it to disk chunk</p></li>
  12278. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1710" target="_top">#1710</a>, unable to filter by attributes created by index_field_lengths=1</p></li>
  12279. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1716" target="_top">#1716</a>, random crash with with multiple running threads</p></li>
  12280. <li class="listitem"><p>fixed crash while querying index with lemmatizer and wordforms</p></li>
  12281. </ul></div></div>
  12282. <div class="sect1" title="A.14.&nbsp;Version 2.1.2-release, 10 oct 2013"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel212"></a>A.14.&nbsp;Version 2.1.2-release, 10 oct 2013</h2></div></div></div>
  12283. <h3><a name="idp34561248"></a>New features</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added <a class="link" href="#sphinxql-flush-ramchunk" title="8.27.&nbsp;FLUSH RAMCHUNK syntax">FLUSH RAMCHUNK</a> statement</p></li>
  12284. <li class="listitem"><p>added <a class="link" href="#sphinxql-show-plan" title="8.34.&nbsp;SHOW PLAN syntax">SHOW PLAN</a> statement</p></li>
  12285. <li class="listitem"><p>added support for <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">GROUP BY</a> on multiple attributes</p></li>
  12286. <li class="listitem"><p>added <a class="link" href="#expression-ranker" title="5.4.3.&nbsp;Expression based ranker (SPH_RANK_EXPR)">BM25F()</a> function to <code class="code">SELECT</code> expressions (now works with the expression based ranker)</p></li>
  12287. <li class="listitem"><p>added <a class="link" href="#ref-indextool" title="7.4.&nbsp;indextool command reference">indextool</a> <code class="option">--fold</code> command and <code class="option">-q</code> switch</p></li>
  12288. <li class="listitem"><p>added JSON debug check for RT index RAM chunk</p></li>
  12289. <li class="listitem"><p>added <a class="link" href="#expr-func-length">LENGTH()</a> function for MVA</p></li>
  12290. <li class="listitem"><p>added missing <a class="link" href="#conf-rt-attr-bool" title="12.2.52.&nbsp;rt_attr_bool">rt_attr_bool</a> directive</p></li>
  12291. <li class="listitem"><p>added support for selecting over 250 columns via SphinxQL</p></li>
  12292. <li class="listitem"><p>deprecated custom sort mode, and <code class="option">str2ordinal</code> and <code class="option">str2wordcount</code> attribute types</p></li>
  12293. <li class="listitem"><p>optimized <code class="code">SELECT</code>, <code class="code">UPDATE</code> for indexes with many attributes (up to 3.5x speedup in extreme cases)</p></li>
  12294. <li class="listitem"><p><code class="code">JSON</code> attributes (up to 5-20% faster <code class="code">SELECTs</code> using JSON objects)</p></li>
  12295. <li class="listitem"><p>optimized <a class="link" href="#xmlpipe2" title="3.9.&nbsp;xmlpipe2 data source">xmlpipe2</a> indexing (up to 9 times faster on some schemas)</p></li>
  12296. </ul></div>
  12297. <h3><a name="idp34580192"></a>Bug fixes</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1684" target="_top">#1684</a>, <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">COUNT(DISTINCT smth)</a> with implicit <code class="code">GROUP BY</code> returns correct value now</p></li>
  12298. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1672" target="_top">#1672</a>, exact token AOT vs lemma (<code class="filename">indexer</code> skips exact form of token that passed AOT through tokenizer)</p></li>
  12299. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1659" target="_top">#1659</a>, fail while loading empty infix dictionary with <a class="link" href="#conf-dict" title="12.2.7.&nbsp;dict">dict=keywords</a></p></li>
  12300. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1638" target="_top">#1638</a>, force explicit JSON type conversion for aggregate functions</p></li>
  12301. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1628" target="_top">#1628</a>, <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">GROUP_CONCAT()</a> and <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">GROUPBY()</a> support for distributed agents</p></li>
  12302. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1619" target="_top">#1619</a>, <code class="code">INTEGER()</code> conversion function doesn't support signed integers</p></li>
  12303. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1615" target="_top">#1615</a>, global IDF vs exact term (=term) fixed global IDF for missed terms fixed SphinxQL <a class="link" href="#conf-global-idf" title="12.2.66.&nbsp;global_idf">global_idf=0 option</a></p></li>
  12304. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1607" target="_top">#1607</a>, now ignoring binlog when running daemon with <code class="option">--console</code> flag</p></li>
  12305. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1606" target="_top">#1606</a>, hard interruption of the daemon by Ctrl+C (SIGINT) signal</p></li>
  12306. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1592" target="_top">#1592</a>, duplicates vs expression ranker</p></li>
  12307. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1578" target="_top">#1578</a>, <a class="link" href="#sorting-modes" title="5.6.&nbsp;Sorting modes">SORT BY</a> string attribute via API <code class="option">attr_asc</code> \ <code class="option">attr_desc</code></p></li>
  12308. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1575" target="_top">#1575</a>, crash of daemon on MVA receive from agents with <a class="link" href="#conf-dist-threads" title="12.4.24.&nbsp;dist_threads">dist_threads</a> enabled</p></li>
  12309. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1574" target="_top">#1574</a>, agent got kill list of local indexes of distributed index</p></li>
  12310. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1573" target="_top">#1573</a>, ranker expression vs expanded terms</p></li>
  12311. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1572" target="_top">#1572</a>, <code class="code">BM25F</code> vs negative terms</p></li>
  12312. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1550" target="_top">#1550</a>, float got cut at full-text part of a query</p></li>
  12313. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1541" target="_top">#1541</a>, <code class="code">BM25F</code> expression in distributes indexes</p></li>
  12314. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1508" target="_top">#1508</a>, <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1522" target="_top">#1522</a>, distributed index query lasts up to <a class="link" href="#conf-agent-connect-timeout" title="12.2.34.&nbsp;agent_connect_timeout">agent_connect_timeout</a> with epoll path</p></li>
  12315. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1508" target="_top">#1508</a>, master failed to connect waiting agents up to <a class="link" href="#conf-agent-connect-timeout" title="12.2.34.&nbsp;agent_connect_timeout">agent_connect_timeout</a> time</p></li>
  12316. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1489" target="_top">#1489</a>, filtering by integer field in JSON using floating point precision</p></li>
  12317. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1485" target="_top">#1485</a>, <a class="link" href="#conf-index-exact-words" title="12.2.42.&nbsp;index_exact_words">index_exact_words</a> vs keyword dict with infix</p></li>
  12318. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1484" target="_top">#1484</a>, <a class="link" href="#sphinxql-insert" title="8.6.&nbsp;INSERT and REPLACE syntax">INSERT</a> into RT vs no JSON attribute</p></li>
  12319. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1478" target="_top">#1478</a>, memory leaks at daemon <a class="link" href="#misc-functions" title="5.5.6.&nbsp;Miscellaneous functions">PACKEDFACTORS()</a> as UDF argument, index query tokenizer, expression ranker SUM()</p></li>
  12320. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1470" target="_top">#1470</a>, broken UDF unpack (since r3738 UDF version 2)</p></li>
  12321. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1468" target="_top">#1468</a>, multiple conditions in <code class="code">WHERE</code> for JSON attributes</p></li>
  12322. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1466" target="_top">#1466</a>, <a class="link" href="#conf-index-field-lengths" title="12.2.63.&nbsp;index_field_lengths">index_field_lengths</a> vs XML data source</p></li>
  12323. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1463" target="_top">#1463</a>, daemon shutdown vs RT index optimize (added forced terminate of long merging operation)</p></li>
  12324. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1460" target="_top">#1460</a>, <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">aggregate functions</a> <code class="code">AVG()</code>, <code class="code">MAX()</code>, <code class="code">MIN()</code>, <code class="code">SUM()</code> do not work for JSON attributes</p></li>
  12325. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1459" target="_top">#1459</a>, <code class="code">BM25F</code> doesn't work with <a class="link" href="#conf-sql-field-string" title="12.1.26.&nbsp;sql_field_string">field_string</a> fields</p></li>
  12326. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1458" target="_top">#1458</a>, factors to copy <code class="code">field_tf</code> at UDF</p></li>
  12327. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1450" target="_top">#1450</a>, garbage in JSON fields when selecting them from a RT index</p></li>
  12328. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1449" target="_top">#1449</a>, broken build on Mac OS X</p></li>
  12329. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1446" target="_top">#1446</a>, <a class="link" href="#weighting" title="5.4.&nbsp;Search results ranking">WEIGHT()</a> did not work in <code class="code">SELECT</code> expressions</p></li>
  12330. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1445" target="_top">#1445</a>, field-start/field-end modifiers did not work for star-expanded keywords</p></li>
  12331. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1443" target="_top">#1443</a>, <a class="link" href="#conf-morphology" title="12.2.6.&nbsp;morphology">morphology=lemmatizer_ru_all</a> now works with <a class="link" href="#conf-index-exact-words" title="12.2.42.&nbsp;index_exact_words">index_exact_words=1</a> (exact forms can be matches)</p></li>
  12332. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1442" target="_top">#1442</a>, incorrect <code class="code">COUNT(*)</code> value in queries to distributed indexes with implicit <code class="code">GROUP BY</code></p></li>
  12333. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1439" target="_top">#1439</a>, filters on float values in JSON issue, string values quoting issue</p></li>
  12334. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1399" target="_top">#1399</a>, filter error message on string attribute</p></li>
  12335. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1384" target="_top">#1384</a>, added possibility to define any own DSN line with <a class="link" href="#confgroup-source" title="12.1.&nbsp;Data source configuration options">source=mssql</a> (like as in <code class="code">source=odbc</code>)</p></li>
  12336. <li class="listitem"><p>fixed <a class="link" href="#sphinxql-attach-index" title="8.25.&nbsp;ATTACH INDEX syntax">ATTACH</a> vs wordforms or stopwords; after daemon was restarted this setting was getting lost in RT indexes</p></li>
  12337. <li class="listitem"><p>fixed balancing of agents in HA</p></li>
  12338. <li class="listitem"><p>fixed co-working of <code class="code">index_exact_word</code> + AOT lemmatizer</p></li>
  12339. <li class="listitem"><p>fixed epoll invoking and turned on by default</p></li>
  12340. <li class="listitem"><p>fixed incorrect handling of wildcards in tokenizer</p></li>
  12341. <li class="listitem"><p>fixed infix indexing with <code class="option">dict=keywords</code></p></li>
  12342. <li class="listitem"><p>fixed <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">max_predicted_time</a> integer overflows</p></li>
  12343. <li class="listitem"><p>fixed memory error in tokenizer</p></li>
  12344. <li class="listitem"><p>fixed several memory leaks</p></li>
  12345. <li class="listitem"><p>fixed <code class="code">PACKEDFACTORS()</code> to work in different <code class="code">GROUP BY</code> queries</p></li>
  12346. <li class="listitem"><p>fixed preprocessor definitions for <a class="link" href="#conf-regexp-filter" title="12.2.64.&nbsp;regexp_filter">RE2</a> in VS solution</p></li>
  12347. <li class="listitem"><p>fixed rotation of global IDF for <code class="option">workers=threads</code> and <code class="option">seamless_rotate=1</code></p></li>
  12348. <li class="listitem"><p>fixed rotation of old indexes</p></li>
  12349. <li class="listitem"><p>fixed RT kill list survives <code class="code">TRUNCATE</code> and works in newly <code class="code">ATTACH</code>ed index</p></li>
  12350. <li class="listitem"><p>fixed saving id32 RT index with id64 daemon</p></li>
  12351. <li class="listitem"><p>fixed stemmer vs RT index <code class="code">INSERT</code></p></li>
  12352. <li class="listitem"><p>fixed string case error with JSON attributes in select list of a query</p></li>
  12353. <li class="listitem"><p>fixed <code class="code">TOP_COUNT</code> usage in <code class="filename">misc/suggest</code> and updated to PHP 5.3 and UTF-8</p></li>
  12354. </ul></div></div>
  12355. <div class="sect1" title="A.15.&nbsp;Version 2.1.1-beta, 20 feb 2013"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel211"></a>A.15.&nbsp;Version 2.1.1-beta, 20 feb 2013</h2></div></div></div>
  12356. <h3><a name="idp34675536"></a>Major new features</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added query profiling (SET PROFILING=1 and <a class="link" href="#sphinxql-show-profile" title="8.30.&nbsp;SHOW PROFILE syntax">SHOW PROFILE</a> statements)</p></li>
  12357. <li class="listitem"><p>added AOT-based Russian lemmatizer (<a class="link" href="#conf-morphology" title="12.2.6.&nbsp;morphology">morphology={lemmatize_ru | lemmatize_ru_all}</a>, <a class="link" href="#conf-lemmatizer-base" title="12.5.1.&nbsp;lemmatizer_base">lemmatizer_base</a>, and <a class="link" href="#conf-lemmatizer-cache" title="12.3.8.&nbsp;lemmatizer_cache">lemmatizer_cache</a> directives)</p></li>
  12358. <li class="listitem"><p>added <a class="link" href="#ref-wordbreaker" title="7.5.&nbsp;wordbreaker command reference">wordbreaker</a>, a tool to split compounds into individual words</p></li>
  12359. <li class="listitem"><p>added JSON attributes support (<a class="link" href="#conf-sql-attr-json" title="12.1.24.&nbsp;sql_attr_json">sql_attr_json</a>, <a class="link" href="#conf-on-json-attr-error" title="12.5.2.&nbsp;on_json_attr_error">on_json_attr_error</a>, <a class="link" href="#conf-json-autoconv-numbers" title="12.5.3.&nbsp;json_autoconv_numbers">json_autoconv_numbers</a>, <a class="link" href="#conf-json-autoconv-keynames" title="12.5.4.&nbsp;json_autoconv_keynames">json_autoconv_keynames</a> directives)</p></li>
  12360. <li class="listitem"><p>added initial subselects support, SELECT * FROM (SELECT ... ORDER BY cond1 LIMIT X) ORDER BY cond2 LIMIT Y</p></li>
  12361. <li class="listitem"><p>added bigram indexing, and phrase searching with bigrams (<a class="link" href="#conf-bigram-index" title="12.2.62.&nbsp;bigram_index">bigram_index</a>, <a class="link" href="#conf-bigram-freq-words" title="12.2.61.&nbsp;bigram_freq_words">bigram_freq_words</a> directives)</p></li>
  12362. <li class="listitem"><p>added HA/LB support, ha_strategy and agent_persistent directives, SHOW AGENT STATUS statement</p></li>
  12363. <li class="listitem"><p>added RT index optimization (<a class="link" href="#sphinxql-optimize-index" title="8.33.&nbsp;OPTIMIZE INDEX syntax">OPTIMIZE INDEX</a> statement, <a class="link" href="#conf-rt-merge-iops" title="12.4.42.&nbsp;rt_merge_iops">rt_merge_iops</a> and <a class="link" href="#conf-rt-merge-maxiosize" title="12.4.43.&nbsp;rt_merge_maxiosize">rt_merge_maxiosize</a> directives)</p></li>
  12364. <li class="listitem"><p>added wildcards support to <a class="link" href="#conf-dict" title="12.2.7.&nbsp;dict">dict=keywords</a> (eg. "t?st*")</p></li>
  12365. <li class="listitem"><p>added substring search support (min_infix_len=2 and above) to <a class="link" href="#conf-dict" title="12.2.7.&nbsp;dict">dict=keywords</a></p></li>
  12366. </ul></div>
  12367. <h3><a name="idp34695744"></a>New features</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added --checkconfig switch to <a class="link" href="#ref-indextool" title="7.4.&nbsp;indextool command reference">indextool</a> to check config file for correctness (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1395" target="_top">#1395</a>)</p></li>
  12368. <li class="listitem"><p>added global IDF support (<a class="link" href="#conf-global-idf" title="12.2.66.&nbsp;global_idf">global_idf</a> directive, <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">OPTION global_idf</a>)</p></li>
  12369. <li class="listitem"><p>added "term1 term2 term3"/0.5 <a class="link" href="#extended-syntax" title="5.3.&nbsp;Extended query syntax">quorum fraction syntax</a> (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1372" target="_top">#1372</a>)</p></li>
  12370. <li class="listitem"><p>added an option to apply stopwords before morphology, <a class="link" href="#conf-stopwords-unstemmed" title="12.2.65.&nbsp;stopwords_unstemmed">stopwords_unstemmed</a> directive</p></li>
  12371. <li class="listitem"><p>added an alternative method to compute keyword IDFs, <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">OPTION idf=plain</a></p></li>
  12372. <li class="listitem"><p>added boolean query optimizations, <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">OPTION boolean_simplify=1</a> (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1294" target="_top">#1294</a>)</p></li>
  12373. <li class="listitem"><p>added stringptr return type support to UDFs, and <a class="link" href="#sphinxql-create-function" title="8.18.&nbsp;CREATE FUNCTION syntax">CREATE FUNCTION ... RETURNS STRING syntax</a></p></li>
  12374. <li class="listitem"><p>added early query termination by predicted execution time (<a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">OPTION max_predicted_time</a>, and <a class="link" href="#conf-predicted-time-costs" title="12.4.44.&nbsp;predicted_time_costs">predicted_time_costs</a> directive)</p></li>
  12375. <li class="listitem"><p>added <a class="link" href="#conf-index-field-lengths" title="12.2.63.&nbsp;index_field_lengths">index_field_lengths</a> directive, BM25A() and BM25F() functions to <a class="link" href="#expression-ranker" title="5.4.3.&nbsp;Expression based ranker (SPH_RANK_EXPR)">expression ranker</a></p></li>
  12376. <li class="listitem"><p>added ranker=export, and <a class="link" href="#expr-func-packedfactors">PACKEDFACTORS()</a> function</p></li>
  12377. <li class="listitem"><p>added <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">OPTION agent_query_timeout</a></p></li>
  12378. <li class="listitem"><p>added support for attribute files over 4 GB (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1274" target="_top">#1274</a>)</p></li>
  12379. <li class="listitem"><p>added addr2line output to crash reports (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1265" target="_top">#1265</a>)</p></li>
  12380. <li class="listitem"><p>added <a class="link" href="#sphinxql-update" title="8.23.&nbsp;UPDATE syntax">OPTION ignore_nonexistent_columns</a> to UPDATE, and a respective <a class="link" href="#api-func-updateatttributes" title="9.7.2.&nbsp;UpdateAttributes">UpdateAttributes()</a> argument</p></li>
  12381. <li class="listitem"><p>added --keep-attrs switch to <a class="link" href="#ref-indexer" title="7.1.&nbsp;indexer command reference">indexer</a></p></li>
  12382. <li class="listitem"><p>added --with-static-mysql, --with-static-pgsql switches to configure</p></li>
  12383. <li class="listitem"><p>added double-buffering for RT <a class="link" href="#sphinxql-insert" title="8.6.&nbsp;INSERT and REPLACE syntax">INSERTs</a> (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1200" target="_top">#1200</a>)</p></li>
  12384. <li class="listitem"><p>added --morph, --dumpdict switch to <a class="link" href="#ref-indextool" title="7.4.&nbsp;indextool command reference">indextool</a></p></li>
  12385. <li class="listitem"><p>added support for multiple wordforms files, comment syntax, and pre/post-morphology <a class="link" href="#conf-wordforms" title="12.2.12.&nbsp;wordforms">wordforms</a></p></li>
  12386. <li class="listitem"><p>added <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">ZONESPANLIST()</a> builtin function</p></li>
  12387. <li class="listitem"><p>added <a class="link" href="#conf-regexp-filter" title="12.2.64.&nbsp;regexp_filter">regexp_filter</a> directive, regexp document/query filtering support (uses RE2)</p></li>
  12388. <li class="listitem"><p>added min_idf, max_idf, sum_idf <a class="link" href="#expression-ranker" title="5.4.3.&nbsp;Expression based ranker (SPH_RANK_EXPR)">ranking factors</a></p></li>
  12389. <li class="listitem"><p>added uservars persistence, and <a class="link" href="#conf-sphinxql-state" title="12.4.38.&nbsp;sphinxql_state">sphinxql_state</a> directive (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1132" target="_top">#1132</a>)</p></li>
  12390. <li class="listitem"><p>added <a class="link" href="#expr-func-poly2d">POLY2D</a>, <a class="link" href="#expr-func-geopoly2d">GEOPOLY2D</a>, <a class="link" href="#expr-func-contains">CONTAINS</a> functions</p></li>
  12391. <li class="listitem"><p>added <a class="link" href="#extended-syntax" title="5.3.&nbsp;Extended query syntax">ZONESPAN</a> operator</p></li>
  12392. <li class="listitem"><p>added <a class="link" href="#conf-snippets-file-prefix" title="12.4.28.&nbsp;snippets_file_prefix">snippets_file_prefix</a> directive</p></li>
  12393. <li class="listitem"><p>added Arabic stemmer, <a class="link" href="#conf-morphology" title="12.2.6.&nbsp;morphology">morphology=stem_ar</a> directive (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=519" target="_top">#519</a>)</p></li>
  12394. <li class="listitem"><p>added <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">OPTION sort_method={pq | kbuffer}</a>, an alternative match sorting method</p></li>
  12395. <li class="listitem"><p>added SPZ (<a class="link" href="#conf-index-sp" title="12.2.8.&nbsp;index_sp">sentence, paragraph</a>, <a class="link" href="#conf-index-zones" title="12.2.9.&nbsp;index_zones">zone</a>) support to RT indexes</p></li>
  12396. <li class="listitem"><p>added support for upto 255 keywords in <a class="link" href="#extended-syntax" title="5.3.&nbsp;Extended query syntax">quorum operator</a> (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1030" target="_top">#1030</a>)</p></li>
  12397. <li class="listitem"><p>added multi-threaded agent querying (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1000" target="_top">#1000</a>)</p></li>
  12398. </ul></div>
  12399. <h3><a name="idp34748624"></a>New SphinxQL features</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added <a class="link" href="#sphinxql-show-index-status" title="8.31.&nbsp;SHOW INDEX STATUS syntax">SHOW INDEX indexname STATUS</a> statement</p></li>
  12400. <li class="listitem"><p>added LIKE clause support to multiple SHOW xxx statements</p></li>
  12401. <li class="listitem"><p>added <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">SNIPPET()</a> function</p></li>
  12402. <li class="listitem"><p>added <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">GROUP_CONCAT()</a> aggregate function</p></li>
  12403. <li class="listitem"><p>added <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">GROUPBY()</a> builtin function</p></li>
  12404. <li class="listitem"><p>added iostats and cpustats to <a class="link" href="#sphinxql-show-meta" title="8.3.&nbsp;SHOW META syntax">SHOW META</a></p></li>
  12405. <li class="listitem"><p>added support for <a class="link" href="#sphinxql-delete" title="8.8.&nbsp;DELETE syntax">DELETE</a> statement over distributed indexes (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1104" target="_top">#1104</a>)</p></li>
  12406. <li class="listitem"><p>added <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">EXIST('attr_name', default_value)</a> builtin function (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1037" target="_top">#1037</a>)</p></li>
  12407. <li class="listitem"><p>added <a class="link" href="#sphinxql-show-variables" title="8.20.&nbsp;SHOW VARIABLES syntax">SHOW VARIABLES WHERE variable_name='xxx'</a> syntax</p></li>
  12408. <li class="listitem"><p>added <a class="link" href="#sphinxql-truncate-rtindex" title="8.28.&nbsp;TRUNCATE RTINDEX syntax">TRUNCATE RTINDEX</a> statement</p></li>
  12409. </ul></div>
  12410. <h3><a name="idp34764416"></a>Major behavior changes and optimizations</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>changed that UDFs are now allowed in fork/prefork modes via <a class="link" href="#conf-sphinxql-state" title="12.4.38.&nbsp;sphinxql_state">sphinxql_state</a> startup script</p></li>
  12411. <li class="listitem"><p>changed that compat_sphinxql_magics now defaults to 0</p></li>
  12412. <li class="listitem"><p>changed that small enough exceptions, wordforms, stopwords files are now embedded into the index header</p></li>
  12413. <li class="listitem"><p>changed that <a class="link" href="#conf-rt-mem-limit" title="12.2.49.&nbsp;rt_mem_limit">rt_mem_limit</a> can now be over 2 GB (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1059" target="_top">#1059</a>)</p></li>
  12414. <li class="listitem"><p>optimized tokenizer (upto 1.25x indexing and snippets speedup)</p></li>
  12415. <li class="listitem"><p>optimized multi-keyword searching (added skiplists)</p></li>
  12416. <li class="listitem"><p>optimized filtering and scan in several frequent cases (single-value, 2-arg, 3-arg WHERE clauses)</p></li>
  12417. </ul></div></div>
  12418. <div class="sect1" title="A.16.&nbsp;Version 2.0.11-dev, xx xxx xxxx"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel2011"></a>A.16.&nbsp;Version 2.0.11-dev, xx xxx xxxx</h2></div></div></div>
  12419. <h3><a name="idp34772880"></a>Bug fixes</h3></div>
  12420. <div class="sect1" title="A.17.&nbsp;Version 2.0.10-release, 22 jan 2014"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel2010"></a>A.17.&nbsp;Version 2.0.10-release, 22 jan 2014</h2></div></div></div>
  12421. <h3><a name="idp34774464"></a>Bug fixes</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1778" target="_top">#1778</a>, <a class="link" href="#extended-syntax" title="5.3.&nbsp;Extended query syntax">SENTENCE and PARAGRAPH</a> operators and infix stars clash</p></li>
  12422. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1774" target="_top">#1774</a>, stack overflow on parsing large expressions</p></li>
  12423. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1744" target="_top">#1744</a>, daemon failed to write to log file bigger than 4G</p></li>
  12424. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1705" target="_top">#1705</a>, expression ranker handling of indexes with more than 32 fields</p></li>
  12425. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1700" target="_top">#1700</a>, crash and cutoff in fullscan <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">reverse_scan=1</a> queries</p></li>
  12426. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1698" target="_top">#1698</a>, proper handling of stopword with blended chars</p></li>
  12427. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1682" target="_top">#1682</a>, field end modifier and <a class="link" href="#conf-index-exact-words" title="12.2.42.&nbsp;index_exact_words">index_exact_words</a> clash</p></li>
  12428. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1678" target="_top">#1678</a>, memory leak in SUM() function of an expression ranker</p></li>
  12429. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1670" target="_top">#1670</a>, updating of MVA attributes in distributed indexes via API</p></li>
  12430. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1662" target="_top">#1662</a>, <a class="link" href="#api-func-escapestring" title="9.7.4.&nbsp;EscapeString">EscapeString()</a> API escapes '&lt;' too now</p></li>
  12431. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1520" target="_top">#1520</a>, <a class="link" href="#api-func-setlimits" title="9.2.1.&nbsp;SetLimits">SetLimits()</a> API documentation</p></li>
  12432. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1491" target="_top">#1491</a>, documentation: space character is prohibited in <a class="link" href="#conf-charset-table" title="12.2.16.&nbsp;charset_table">charset_table</a></p></li>
  12433. <li class="listitem"><p>fixed memory leak in expressions with max_window_hits</p></li>
  12434. <li class="listitem"><p>fixed <a class="link" href="#conf-rt-flush-period" title="12.4.33.&nbsp;rt_flush_period">rt_flush_period</a> - less stricter internal check and more often flushes overall</p></li>
  12435. </ul></div></div>
  12436. <div class="sect1" title="A.18.&nbsp;Version 2.0.9-release, 26 aug 2013"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel209"></a>A.18.&nbsp;Version 2.0.9-release, 26 aug 2013</h2></div></div></div>
  12437. <h3><a name="idp34799056"></a>Bug fixes</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1655" target="_top">#1655</a>, special characters like ()?* were not processed correctly by exceptions</p></li>
  12438. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1651" target="_top">#1651</a>, <a class="link" href="#sphinxql-create-function" title="8.18.&nbsp;CREATE FUNCTION syntax">CREATE FUNCTION</a> can now be used with BIGINT return type</p></li>
  12439. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1649" target="_top">#1649</a>, incorrect warning message (about statistics mismatch) was returned when mixing wildcards and regular keywords</p></li>
  12440. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1603" target="_top">#1603</a>, passing MVA64 arguments to non-MVA functions caused unpredicted behavior and crashes (now explicitly forbidden)</p></li>
  12441. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1601" target="_top">#1601</a>, negative numbers in <a class="link" href="#expr-func-in">IN()</a> clause caused a syntax error</p></li>
  12442. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1581" target="_top">#1581</a>, <a class="link" href="#conf-dict" title="12.2.7.&nbsp;dict">dict=keywords</a> and <a class="link" href="#conf-sql-joined-field" title="12.1.13.&nbsp;sql_joined_field">sql_joined_field</a> occasionally caused <code class="filename">indexer</code> to build corrupted indexes</p></li>
  12443. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1546" target="_top">#1546</a>, file descriptor leaked on index rotation (that eventually prevented <code class="filename">searchd</code> to reload indexes)</p></li>
  12444. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1537" target="_top">#1537</a>, <code class="code">COUNT(*)</code> and compat_sphinxql_magics=0 via SphinxAPI caused an incorrect error message</p></li>
  12445. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1531" target="_top">#1531</a>, #1589, several matching and highlighting issues when using both <a class="link" href="#conf-blend-chars" title="12.2.47.&nbsp;blend_chars">blend_chars</a> and multi-wordforms</p></li>
  12446. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1521" target="_top">#1521</a>, <code class="filename">indextool --check</code> did not handle empty RT MVA and gave an incorrect warning</p></li>
  12447. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1392" target="_top">#1392</a>, SphinxSE builds with MySQL 5.6 now</p></li>
  12448. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1346" target="_top">#1346</a>, <a class="link" href="#extended-syntax" title="5.3.&nbsp;Extended query syntax">NEAR</a> handles duplicated keywords properly now</p></li>
  12449. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=757" target="_top">#757</a>, wordforms shared between multiple indexes with different tokenizer settings failed to load (they now load with a warning)</p></li>
  12450. <li class="listitem"><p>fixed that batch queries did not batch in some cases (because of internal expression alias issues)</p></li>
  12451. <li class="listitem"><p>fixed that <a class="link" href="#sphinxql-call-keywords" title="8.15.&nbsp;CALL KEYWORDS syntax">CALL KEYWORDS</a> occasionally gave incorrect error messages</p></li>
  12452. <li class="listitem"><p>fixed searchd crashes on <a class="link" href="#sphinxql-attach-index" title="8.25.&nbsp;ATTACH INDEX syntax">ATTACHing</a> plain indexes with MVAs</p></li>
  12453. <li class="listitem"><p>fixed several deadlocks and other threading issues</p></li>
  12454. <li class="listitem"><p>fixed incorrect sorting order with <a class="link" href="#collations" title="5.12.&nbsp;Collations">utf8_general_ci</a></p></li>
  12455. <li class="listitem"><p>fixed that in some cases incorrect attribute values were returned when using expression aliases</p></li>
  12456. <li class="listitem"><p>optimized <a class="link" href="#xmlpipe2" title="3.9.&nbsp;xmlpipe2 data source">xmlpipe2</a> indexing</p></li>
  12457. <li class="listitem"><p>added a warning for missed stopwords, exception, wordforms files on index load and in <code class="filename">indextool --check</code></p></li>
  12458. </ul></div></div>
  12459. <div class="sect1" title="A.19.&nbsp;Version 2.0.8-release, 26 apr 2013"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel208"></a>A.19.&nbsp;Version 2.0.8-release, 26 apr 2013</h2></div></div></div>
  12460. <h3><a name="idp34834576"></a>Bug fixes</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1515" target="_top">#1515</a>, log strings over 2KB were clipped when <a class="link" href="#conf-query-log-format" title="12.4.4.&nbsp;query_log_format">query_log_format=plain</a></p></li>
  12461. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1514" target="_top">#1514</a>, RT index disk chunk lose attribute update on daemon restart</p></li>
  12462. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1512" target="_top">#1512</a>, crash while formatting log messages</p></li>
  12463. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1511" target="_top">#1511</a>, crash on indexing PostgreSQL data source with <a class="link" href="#mva" title="3.4.&nbsp;MVA (multi-valued attributes)">MVA</a> attributes</p></li>
  12464. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1509" target="_top">#1509</a>, <a class="link" href="#conf-blend-chars" title="12.2.47.&nbsp;blend_chars">blend_chars</a> vs incomplete multi-form and overshort</p></li>
  12465. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1504" target="_top">#1504</a>, RT binlog replay vs descending tid on update</p></li>
  12466. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1499" target="_top">#1499</a>, <code class="option">sql_field_str2wordcount</code> actually is int, not string</p></li>
  12467. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1498" target="_top">#1498</a>, now working with exceptions starting with number too</p></li>
  12468. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1496" target="_top">#1496</a>, multiple destination keywords in wordform</p></li>
  12469. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1494" target="_top">#1494</a>, lost 'mod', '%' operations in select list. Also corrected few typers in the doc.</p></li>
  12470. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1490" target="_top">#1490</a>, <a class="link" href="#conf-expand-keywords" title="12.2.46.&nbsp;expand_keywords">expand_keywords</a> vs prefix</p></li>
  12471. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1487" target="_top">#1487</a>, `id` in expression fixed</p></li>
  12472. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1483" target="_top">#1483</a>, snippets limits fix</p></li>
  12473. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1481" target="_top">#1481</a>, shebang config changes check on rotation</p></li>
  12474. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1479" target="_top">#1479</a>, port handling in <a class="link" href="#api-reference" title="Chapter&nbsp;9.&nbsp;API reference">PHP Sphinx API</a></p></li>
  12475. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1474" target="_top">#1474</a>, daemon crash at SphinxQL packet overflows <a class="link" href="#conf-max-packet-size" title="12.4.13.&nbsp;max_packet_size">max_packet_size</a></p></li>
  12476. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1472" target="_top">#1472</a>, crash on loading index to <code class="filename">indextool</code> for check</p></li>
  12477. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1465" target="_top">#1465</a>, <a class="link" href="#conf-expansion-limit" title="12.4.35.&nbsp;expansion_limit">expansion_limit</a> got lost in index rotation</p></li>
  12478. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1427" target="_top">#1427</a>, #1506, utf8 3 and 4-bytes codepoints</p></li>
  12479. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1405" target="_top">#1405</a>, between with mixed int float values</p></li>
  12480. </ul></div></div>
  12481. <div class="sect1" title="A.20.&nbsp;Version 2.0.7-release, 26 mar 2013"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel207"></a>A.20.&nbsp;Version 2.0.7-release, 26 mar 2013</h2></div></div></div>
  12482. <h3><a name="idp34869328"></a>Bug fixes</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1475" target="_top">#1475</a>, memory leak in the expression parser</p></li>
  12483. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1457" target="_top">#1457</a>, error messages over 2KB were clipped</p></li>
  12484. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1454" target="_top">#1454</a>, searchd did not display an error message when the binlog path did not exist</p></li>
  12485. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1441" target="_top">#1441</a>, SHOW META in a query batch was returning the last non-batch error</p></li>
  12486. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1435" target="_top">#1435</a>, typo in the documentation</p></li>
  12487. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1430" target="_top">#1430</a>, rt_flush_period now works even with a disabled binlog</p></li>
  12488. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1427" target="_top">#1427</a>, overlong 4-byte UTF-8 codes in source text could cause indexer crashes or index corruption</p></li>
  12489. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1418" target="_top">#1418</a>, warnings from local index searches were lost with dist_threads&gt;0</p></li>
  12490. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1417" target="_top">#1417</a>, crash handler now works on searchd startup stage, too (eg. to report index load time crashes)</p></li>
  12491. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1410" target="_top">#1410</a>, bad numerics like '123abc' now result in a proper SphinxQL error message</p></li>
  12492. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1404" target="_top">#1404</a>, a tiny memory leak in shared mutex</p></li>
  12493. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1394" target="_top">#1394</a>, race in --iostats caused incorrect I/O statistics in threaded modes</p></li>
  12494. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1391" target="_top">#1391</a>, QUORUM operator vs docinfo=inline returned wrong attribute values</p></li>
  12495. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1389" target="_top">#1389</a>, edge case in the ORDER operator caused occasionally searchd crashes</p></li>
  12496. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1382" target="_top">#1382</a>, query parts with field limits but without real keywords (like '@name {') are now simply ignored and no longer cause a query syntax error</p></li>
  12497. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1370" target="_top">#1370</a>, Windows indexer builds failed to fetch rows from MSSQL 2012</p></li>
  12498. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1368" target="_top">#1368</a>, ORDER BY RAND() did not work in RT indexes</p></li>
  12499. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1364" target="_top">#1364</a>, queries with hitless words could occasionally crash searchd</p></li>
  12500. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1363" target="_top">#1363</a>, '*' in charset_table was causing query syntax errors with enable_star=1</p></li>
  12501. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1353" target="_top">#1353</a>, added filtering by 'id' syntax (in addition to '@id') to SphinxSE</p></li>
  12502. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1346" target="_top">#1346</a>, fixed NEAR operator behavior vs duplicated keywords</p></li>
  12503. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1345" target="_top">#1345</a>, invalid PROXIMITY operator threshold now causes a query syntax error rather than unexpected search behavior</p></li>
  12504. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1343" target="_top">#1343</a>, misconfigured indexes with 0 full text fields are now explicitly forbidden</p></li>
  12505. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1342" target="_top">#1342</a>, specific error messages (from the preload stage) went missing when failing to load the indexes</p></li>
  12506. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1339" target="_top">#1339</a>, no warning on inconsistent word statistics</p></li>
  12507. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1335" target="_top">#1335</a>, typo in searchd help screen</p></li>
  12508. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1334" target="_top">#1334</a>, typo in SELECT documentation</p></li>
  12509. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1316" target="_top">#1316</a>, PHRASE operator did not match in a rare self-repeating document/query case</p></li>
  12510. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1297" target="_top">#1297</a>, letting queries complete gracefully instead of killing them off in seamless_rotate=1, workers=prefork case</p></li>
  12511. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1295" target="_top">#1295</a>, mentioned index naming requirements (proper identifier) in the FROM clause docs</p></li>
  12512. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1221" target="_top">#1221</a>, incorrect results when using @groupby in select list via SphinxAPI with compat_sphinxql_magics=0</p></li>
  12513. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1180" target="_top">#1180</a>, special SPZ chars occasionally leaking into snippets</p></li>
  12514. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1171" target="_top">#1171</a>, preforked children did not reload logs on SIGUSR1</p></li>
  12515. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1150" target="_top">#1150</a>, added support for `id` syntax in DELETE and parents in WHERE</p></li>
  12516. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1135" target="_top">#1135</a>, crashes when using MVA/strings attributes in expression ranker</p></li>
  12517. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1124" target="_top">#1124</a>, corrupted attributes after merging with an empty index</p></li>
  12518. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1090" target="_top">#1090</a>, SphinxSE snippets UDF updated to support MySQL 5.5</p></li>
  12519. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1041" target="_top">#1041</a>, added initial support for MVA updates (and other mutex protected things) on FreeBSD</p></li>
  12520. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=999" target="_top">#999</a>, fullscan returned empty result sets in mixed batches of fullscan and fulltext queries</p></li>
  12521. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=921" target="_top">#921</a>, document count/bytes 32bit overflow in indexer progress output</p></li>
  12522. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=539" target="_top">#539</a>, added processing suffix rules with dots in .affix file to spelldump</p></li>
  12523. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=481" target="_top">#481</a>, rotation did not work on Windows with preopen=1</p></li>
  12524. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=268" target="_top">#268</a>, added warnings about duplicate elements in xmlpipe2</p></li>
  12525. <li class="listitem"><p>fixed CSphStaticMutex (double initialization issue)</p></li>
  12526. <li class="listitem"><p>fixed documentation typo in SQL data sources</p></li>
  12527. <li class="listitem"><p>fixed too-late initialization of mutex at daemon</p></li>
  12528. <li class="listitem"><p>fixed that an instance of searchd resurrected by watchdog could leak resources and/or crash</p></li>
  12529. <li class="listitem"><p>added a console message about crashes during index loading at startup</p></li>
  12530. <li class="listitem"><p>added more debug info about failed index loading</p></li>
  12531. </ul></div></div>
  12532. <div class="sect1" title="A.21.&nbsp;Version 2.0.6-release, 22 oct 2012"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel206"></a>A.21.&nbsp;Version 2.0.6-release, 22 oct 2012</h2></div></div></div>
  12533. <h3><a name="idp34932704"></a>Bug fixes</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1322" target="_top">#1322</a>, J connector seems to be broken in rel20 , but works in trunk</p></li>
  12534. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1321" target="_top">#1321</a>, 'set names utf8' passes, but 'set names utf-8' doesn't because of syntax error '-'</p></li>
  12535. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1318" target="_top">#1318</a>, unhandled float comparison operators at filter</p></li>
  12536. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1317" target="_top">#1317</a>, FD leaks on thread seamless rotation</p></li>
  12537. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1313" target="_top">#1313</a>, crash on stopping daemon with incorrect RT index config</p></li>
  12538. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1306" target="_top">#1306</a>, 'jolly roger ;)', and '(((((((((9 brackets)' crashes <code class="filename">searchd</code></p></li>
  12539. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1304" target="_top">#1304</a>, OS X debug compilation</p></li>
  12540. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1302" target="_top">#1302</a>, daemon random crashes on OS X</p></li>
  12541. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1301" target="_top">#1301</a>, <code class="filename">indexer</code> fails to send rotate signal</p></li>
  12542. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1300" target="_top">#1300</a>, lost index settings on attach</p></li>
  12543. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1299" target="_top">#1299</a>, daemon failed to rotate <a class="link" href="#sphinxql-attach-index" title="8.25.&nbsp;ATTACH INDEX syntax">ATTACH</a>ed plain index</p></li>
  12544. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1289" target="_top">#1289</a>, <a class="link" href="#extended-syntax" title="5.3.&nbsp;Extended query syntax">SENTENCE</a> or <a class="link" href="#extended-syntax" title="5.3.&nbsp;Extended query syntax">PARAGRAPH</a> searching leak memory</p></li>
  12545. <li class="listitem"><p>fixes #1285, crash on running <code class="filename">searchd</code> with <code class="filename">syslog</code> and <code class="filename">watchdog</code></p></li>
  12546. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1279" target="_top">#1279</a>, linking against explicitly disabled iconv. Also added <code class="code">--with-libexpat</code> to config options, which sometimes required on systems without XML support</p></li>
  12547. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1278" target="_top">#1278</a>, broken <a class="link" href="#conf-odbc-dsn" title="12.1.10.&nbsp;odbc_dsn">unixODBC</a> detection in configure script.</p></li>
  12548. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1277" target="_top">#1277</a>, broken build on some toolchains (like uClibc) where not defined <code class="code">LLONG_MIN</code>, added <code class="code">ULLONG_MAX</code></p></li>
  12549. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1274" target="_top">#1274</a>, large <code class="filename">spa</code> ( &gt;4GB ) file hasn't loaded</p></li>
  12550. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1269" target="_top">#1269</a>, crash at RT index with <a class="link" href="#mva" title="3.4.&nbsp;MVA (multi-valued attributes)">MVA</a> from disk chunk previously updated</p></li>
  12551. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1268" target="_top">#1268</a>, unuseful warning removed</p></li>
  12552. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1264" target="_top">#1264</a>, string and MVA attributes aliasing works again</p></li>
  12553. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1254" target="_top">#1254</a>, its now possible to add indexes using <a class="link" href="#ref-indexer" title="7.1.&nbsp;indexer command reference">--rotate</a></p></li>
  12554. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1249" target="_top">#1249</a>, <a class="link" href="#sphinxql-reference" title="Chapter&nbsp;8.&nbsp;SphinxQL reference">SphinxQL</a> unusable with PHP &gt;= 5.4.5</p></li>
  12555. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1246" target="_top">#1246</a>, attributes of 100 character length not being saved</p></li>
  12556. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1234" target="_top">#1234</a>, case sensitive <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">GROUP BY</a> attribute</p></li>
  12557. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1216" target="_top">#1216</a>, typos, <a class="link" href="#conf-mem-limit" title="12.3.1.&nbsp;mem_limit">mem_limit</a> default size and <a class="link" href="#rt-indexes" title="Chapter&nbsp;4.&nbsp;Real-time indexes">RT documentation</a></p></li>
  12558. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1148" target="_top">#1148</a>, RT documentation updated</p></li>
  12559. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1140" target="_top">#1140</a>, mem_limit default value</p></li>
  12560. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1138" target="_top">#1138</a>, updated documentation on <a class="link" href="#conf-sql-attr-string" title="12.1.23.&nbsp;sql_attr_string">sql_attr_string</a></p></li>
  12561. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1129" target="_top">#1129</a>, snippets vs empty files and empty filenames</p></li>
  12562. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1123" target="_top">#1123</a>, configure compatibility fix</p></li>
  12563. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1122" target="_top">#1122</a>, 64bit <a class="link" href="#conf-sql-range-step" title="12.1.15.&nbsp;sql_range_step">sql_range_step</a></p></li>
  12564. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1082" target="_top">#1082</a>, crashes and deadlocks on OS X with <code class="code">workers=threads</code> and field leak of read-write lock</p></li>
  12565. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1081" target="_top">#1081</a>, select only count distinct attr1 but group by attr2</p></li>
  12566. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1064" target="_top">#1064</a>, mistake while working with timestamp functions</p></li>
  12567. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1043" target="_top">#1043</a>, inaccurate distinct count in case many indexes or distributed index</p></li>
  12568. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1042" target="_top">#1042</a>, arithmetic expressions overflow</p></li>
  12569. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1007" target="_top">#1007</a>, Russian stemming on big endian systems</p></li>
  12570. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=986" target="_top">#986</a>, asserting in <a class="link" href="#api-func-setrankingmode" title="9.3.2.&nbsp;SetRankingMode">SetRankingMode</a> (PHP API)</p></li>
  12571. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=975" target="_top">#975</a>, incorrect ranking in some rare cases</p></li>
  12572. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=967" target="_top">#967</a>, Python API type checking error</p></li>
  12573. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=934" target="_top">#934</a>, API vs fullscan vs non-empty query</p></li>
  12574. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=899" target="_top">#899</a>, error if using <a class="link" href="#api-func-setfilterrange" title="9.4.3.&nbsp;SetFilterRange">SetFilterRange</a> as HAVING from SQL</p></li>
  12575. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=867" target="_top">#867</a>, <code class="filename">indexer</code> accepts index names starting with digit or _</p></li>
  12576. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=699" target="_top">#699</a>, signed vs unsigned 64-bit DocIDs in SphinxQL</p></li>
  12577. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=668" target="_top">#668</a>, now ignoring single @ character (incorrect field operator)</p></li>
  12578. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=611" target="_top">#611</a>, @! operator vs non-existent field, updated documentation</p></li>
  12579. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=412" target="_top">#412</a>, multiple <code class="code">--filter</code> arguments work as they should in search utility</p></li>
  12580. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=108" target="_top">#108</a>, support for system libstemmer library. The sources of libstemmer placed into <code class="filename">libstemmer_c</code> is preferred, but the system lib will be tried if no sources found</p></li>
  12581. <li class="listitem"><p>fixed <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">ORDER BY</a> output at query log with SphinxQL mode</p></li>
  12582. <li class="listitem"><p>fixed documentation entry about <a class="link" href="#conf-sql-joined-field" title="12.1.13.&nbsp;sql_joined_field">sql_joined_field</a></p></li>
  12583. <li class="listitem"><p>fixed sample config file</p></li>
  12584. <li class="listitem"><p>fixed x64 configurations for libstemmer</p></li>
  12585. </ul></div></div>
  12586. <div class="sect1" title="A.22.&nbsp;Version 2.0.5-release, 28 jul 2012"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel205"></a>A.22.&nbsp;Version 2.0.5-release, 28 jul 2012</h2></div></div></div>
  12587. <h3><a name="idp35019888"></a>Bug fixes</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1258" target="_top">#1258</a>, <code class="code">xmlpipe2</code> refused to index indexes with <code class="code">docinfo=inline</code></p></li>
  12588. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1257" target="_top">#1257</a>, legacy groupby modes vs <code class="code">dist_threads</code> could occasionally return wrong search results (race condition)</p></li>
  12589. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1253" target="_top">#1253</a>, missing single-word query performance optimization (simplified ranker) vs prefix-expanded keywords vs <code class="code">dict=keywords</code></p></li>
  12590. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1252" target="_top">#1252</a>, COUNT(*) vs <a class="link" href="#conf-dist-threads" title="12.4.24.&nbsp;dist_threads">dist_threads</a> could occasionally crash (race condition)</p></li>
  12591. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1251" target="_top">#1251</a>, missing expression support in the <a class="link" href="#expr-func-in">IN()</a> function</p></li>
  12592. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1245" target="_top">#1245</a>, <a class="link" href="#api-func-flushattributes" title="9.7.6.&nbsp;FlushAttributes">FlushAttributes</a> mistakenly disabled by <a class="link" href="#conf-attr-flush-period" title="12.4.12.&nbsp;attr_flush_period">attr_flush_period=0</a> setting</p></li>
  12593. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1244" target="_top">#1244</a>, per-API-command (search, update, etc) statistics were not updated by SphinxQL requests</p></li>
  12594. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1243" target="_top">#1243</a>, misc issues (broken statistics, weights, checks) with very long keywords having blended parts in RT indexes</p></li>
  12595. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1240" target="_top">#1240</a>, embedded <code class="code">xmlpipe2</code> schema with more attributes than the <code class="code">sphinx.conf</code> one caused <code class="filename">indexer</code> to crash</p></li>
  12596. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1239" target="_top">#1239</a>, memory leak when optimizing <code class="code">ABS(const)</code> and other 1-arg functions</p></li>
  12597. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1228" target="_top">#1228</a>, #761, #1183, #1190, #1198, misc issues occasonally caused by MVA updates (crash on SaveAttributes; index rotation vs index name and TID; looped MVA updates; persistent MVA removal on rotation)</p></li>
  12598. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1227" target="_top">#1227</a>, API queries with <code class="code">SetGeoAnchor()</code> were logged incorrectly in SphinxQL-format query logs (<code class="code">query_log_format=sphinxql</code>)</p></li>
  12599. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1214" target="_top">#1214</a>, phrase query parsing issues when <a class="link" href="#conf-blend-chars" title="12.2.47.&nbsp;blend_chars">blend_chars</a> contained a quote (") symbol</p></li>
  12600. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1213" target="_top">#1213</a>, attribute aliases were not recognized by the subsequent <code class="code">SELECT</code> items</p></li>
  12601. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1212" target="_top">#1212</a>, <a class="link" href="#ref-indextool" title="7.4.&nbsp;indextool command reference"><code class="filename">indextool</code></a> failed to check hitless keywords</p></li>
  12602. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1210" target="_top">#1210</a>, crash when indexing an index with joined fields only (no regular fields)</p></li>
  12603. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1209" target="_top">#1209</a>, <code class="code">xmlpipe_fixup_utf8</code> off by a byte on certain (pretty rare) malformed sequences</p></li>
  12604. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1202" target="_top">#1202</a>, various issues with <code class="code">CALL KEYWORDS</code> vs RT indexes (crashes vs <code class="code">dict=keywords</code>, missing modifiers in output)</p></li>
  12605. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1201" target="_top">#1201</a>, snippets vs <code class="code">query_mode=1</code> vs complex OR-queries could occasionally crash</p></li>
  12606. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1197" target="_top">#1197</a>, <code class="filename">indexer</code> running out of disk space could either crash, or fail to display a proper error message</p></li>
  12607. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1185" target="_top">#1185</a>, keywords with wildcards were not handled when highlighting the entire document</p></li>
  12608. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1184" target="_top">#1184</a>, <code class="filename">indexer</code> crash when <a class="link" href="#conf-ngram-chars" title="12.2.24.&nbsp;ngram_chars">ngram_chars</a> was set, but <a class="link" href="#conf-ngram-len" title="12.2.23.&nbsp;ngram_len">ngram_len=0</a></p></li>
  12609. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1182" target="_top">#1182</a>, <code class="filename">indexer</code> crash on certain combinations of <a class="link" href="#conf-docinfo" title="12.2.4.&nbsp;docinfo"><code class="code">docinfo=inline</code></a> vs bitfields</p></li>
  12610. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1181" target="_top">#1181</a>, <code class="code">GROUP BY</code> on a MVA64 was truncated at 32 bits</p></li>
  12611. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1179" target="_top">#1179</a>, <code class="code">passage_boundary</code> in snippets could get ignored (when highlighting the entire document)</p></li>
  12612. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1178" target="_top">#1178</a>, <code class="filename">indexer</code> could crash when <code class="code">charset_table</code> specified out-of-bounds codes</p></li>
  12613. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1177" target="_top">#1177</a>, SPZ queries in snippets erroneously required <a class="link" href="#api-func-buildexcerpts" title="9.7.1.&nbsp;BuildExcerpts">passage_boundary</a> option to be explicitly set</p></li>
  12614. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1176" target="_top">#1176</a>, multi-queries with a <code class="code">GROUP/ORDER BY</code> on a string attributed crashed</p></li>
  12615. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1175" target="_top">#1175</a>, connection id mismatch in SphinxQL-format query logs</p></li>
  12616. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1167" target="_top">#1167</a>, nested parentheses in a full-text query could mistakenly reset preceding field or zone limit operator</p></li>
  12617. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1158" target="_top">#1158</a>, float range filters were not supported in a multi-query batch optimizer</p></li>
  12618. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1157" target="_top">#1157</a>, broken gcc-4.7 build</p></li>
  12619. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1156" target="_top">#1156</a>, empty result set instead of an error message when querying distributed indexes with compat_sphinxql_magic=1 and hitting an error</p></li>
  12620. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1143" target="_top">#1143</a>, dash after a number incorrectly parsed as an operator <code class="code">NOT</code></p></li>
  12621. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1137" target="_top">#1137</a>, <code class="filename">searchd</code> <a class="link" href="#ref-searchd" title="7.2.&nbsp;searchd command reference">--stopwait</a> hanged when the running instance crashed during shutdown</p></li>
  12622. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1136" target="_top">#1136</a>, high idle CPU load on systems without <code class="code">pthread_timed_lock()</code></p></li>
  12623. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1134" target="_top">#1134</a>, issues with <code class="code">prefork</code> workers on systems without <code class="code">pthread_timed_lock()</code></p></li>
  12624. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1133" target="_top">#1133</a>, <a class="link" href="#api-func-buildexcerpts" title="9.7.1.&nbsp;BuildExcerpts"><code class="code">BuildExcerpts()</code></a> on a distributed index with <code class="code">load_files</code> did not distribute the jobs</p></li>
  12625. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1126" target="_top">#1126</a>, inaccurate hits sorting progress report on joined field indexing</p></li>
  12626. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1121" target="_top">#1121</a>, occasional bad entries (wrong characters or invalid SQL) in SphinxQL-format query log</p></li>
  12627. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1118" target="_top">#1118</a>, <code class="code">libsphinxclient</code> requests failed when using <code class="code">SPH_RANK_EXPR</code></p></li>
  12628. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1073" target="_top">#1073</a>, improved handling of wordforms/multiforms rules referring to stopwords</p></li>
  12629. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1062" target="_top">#1062</a>, bigint filter ranges truncated when searching via <a class="link" href="#sphinxql-reference" title="Chapter&nbsp;8.&nbsp;SphinxQL reference">SphinxQL</a></p></li>
  12630. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1052" target="_top">#1052</a>, SphinxSE range arguments with leading zeroes mistakenly parsed as octal</p></li>
  12631. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1011" target="_top">#1011</a>, negative MVA64 values mistakenly converted to positive (on indexing and/or output)</p></li>
  12632. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=974" target="_top">#974</a>, crash when logging queries over 2048 bytes with performance counters enabled</p></li>
  12633. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=909" target="_top">#909</a>, field-end modifier was ignored when followed by a non-whitespace syntax character (eg quote or bracket)</p></li>
  12634. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=907" target="_top">#907</a>, issue with bigint filtering (large positive or negative values)</p></li>
  12635. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=906" target="_top">#906</a>, #1074, Mac OS X 10.7.3 builds (conflicting memory allocation routines in Sphinx and external libs)</p></li>
  12636. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=901" target="_top">#901</a>, #1066, sending bigger request packets was broken in Python API</p></li>
  12637. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=879" target="_top">#879</a>, filters on weight-dependent expressions did not work correctly</p></li>
  12638. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=553" target="_top">#553</a>, default/missing port value was not handled properly in <a class="link" href="#api-func-setserver" title="9.1.3.&nbsp;SetServer">SetServer()</a> API call</p></li>
  12639. <li class="listitem"><p>fixed that blended vs multiforms vs <a class="link" href="#conf-min-word-len" title="12.2.15.&nbsp;min_word_len">min_word_len</a> could hang the query parser</p></li>
  12640. <li class="listitem"><p>fixed missing command-line switches documentation</p></li>
  12641. </ul></div></div>
  12642. <div class="sect1" title="A.23.&nbsp;Version 2.0.4-release, 02 mar 2012"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel204"></a>A.23.&nbsp;Version 2.0.4-release, 02 mar 2012</h2></div></div></div>
  12643. <h3><a name="idp35120240"></a>Bug fixes</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=605" target="_top">#605</a>, pack vs mysql compress</p></li>
  12644. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=783" target="_top">#783</a>, #862, #917, #985, #990, #1032 documentation bugs</p></li>
  12645. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=885" target="_top">#885</a>, bitwise AND/OR were not available via API</p></li>
  12646. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=984" target="_top">#984</a>, crash on indexing data with MAGIC_CODE_ZONE symbol</p></li>
  12647. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1004" target="_top">#1004</a>, RT index loses words from dictionary on segments merging with <code class="code">id64</code> enabled</p></li>
  12648. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1035" target="_top">#1035</a>, daemon doesn't properly handle FDs in case of socket overflow FD_SETSIZE ( *nix, <code class="code">preopen_indexes=0</code>, <code class="code">worker=threads</code> )</p></li>
  12649. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1038" target="_top">#1038</a>, quoted string for API select</p></li>
  12650. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1046" target="_top">#1046</a>, head SPZ overflow, snippet generation at non fast with SPZ</p></li>
  12651. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1048" target="_top">#1048</a>, distributed index can't sort \ filter because of missed attributes</p></li>
  12652. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1050" target="_top">#1050</a>, expression ranker vs agents</p></li>
  12653. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1051" target="_top">#1051</a>, added <a class="link" href="#mva" title="3.4.&nbsp;MVA (multi-valued attributes)">MVA64</a> support to <a class="link" href="#sphinx-udfs" title="6.1.&nbsp;Sphinx UDFs (User Defined Functions)">UDFs</a></p></li>
  12654. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1054" target="_top">#1054</a>, <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">max_query_time</a> not handled properly on searching at <a class="link" href="#rt-indexes" title="Chapter&nbsp;4.&nbsp;Real-time indexes">RT index</a></p></li>
  12655. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1055" target="_top">#1055</a>, <a class="link" href="#conf-expansion-limit" title="12.4.35.&nbsp;expansion_limit">expansion_limit</a> on searching at RT disk chunks</p></li>
  12656. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1057" target="_top">#1057</a>, daemon crashes on generating snippet with 0 documents provided</p></li>
  12657. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1060" target="_top">#1060</a>, <a class="link" href="#api-func-buildexcerpts" title="9.7.1.&nbsp;BuildExcerpts">load_files_scattered</a> don't work</p></li>
  12658. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1065" target="_top">#1065</a>, libsphinxclient vs distribute index (agents)</p></li>
  12659. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1067" target="_top">#1067</a>, modifiers were not escaped in legacy query emulation</p></li>
  12660. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1071" target="_top">#1071</a>, master - agent communication got slower for a large query</p></li>
  12661. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1076" target="_top">#1076</a>, #1077, (redundant copying, and a possible mutex leak with uservars)</p></li>
  12662. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1078" target="_top">#1078</a>, <code class="code">blended</code> vs FIELD_END</p></li>
  12663. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1084" target="_top">#1084</a> crash \ index corruption on loading persist MVA</p></li>
  12664. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1091" target="_top">#1091</a>, RT attach of plain index with string \ MVA attributes prior regular attributes</p></li>
  12665. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1092" target="_top">#1092</a>, update got binloged with wrong TID</p></li>
  12666. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1098" target="_top">#1098</a>, crash on creating large expression</p></li>
  12667. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1099" target="_top">#1099</a>, cleaning up temporary files on fail of indexing</p></li>
  12668. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1100" target="_top">#1100</a>, missing <a class="link" href="#conf-xmlpipe-attr-bigint" title="12.1.35.&nbsp;xmlpipe_attr_bigint">xmlpipe_attr_bigint</a> config directive</p></li>
  12669. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1101" target="_top">#1101</a>, now ignoring dashes within keywords when dash is not in charset_table</p></li>
  12670. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1103" target="_top">#1103</a>, <code class="code">ZONE</code> operator incorrectly works on more than one keywords in a simple zone</p></li>
  12671. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1106" target="_top">#1106</a>, optimized <code class="code">WHERE id=value</code>, <code class="code">WHERE id IN (values_list)</code> clauses used in <code class="code">SELECT</code>, <code class="code">UPDATE</code> statements</p></li>
  12672. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1112" target="_top">#1112</a>, Sphinx doesn't work out-of-the-box because the collision of <code class="code">binlog_path</code> option</p></li>
  12673. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1116" target="_top">#1116</a>, crash on <code class="code">FLUSH RTINDEX</code> unknown-index-name</p></li>
  12674. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1117" target="_top">#1117</a>, occasional RT headers corruption (leading to crashes and/or missing results)</p></li>
  12675. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1119" target="_top">#1119</a>, missing expression ranker support in SphinxSE</p></li>
  12676. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1120" target="_top">#1120</a>, negative <a class="link" href="#api-funcgroup-querying" title="9.6.&nbsp;Querying">total_found</a>, docs and hits counter on huge indexes</p></li>
  12677. </ul></div></div>
  12678. <div class="sect1" title="A.24.&nbsp;Version 2.0.3-release, 23 dec 2011"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel203"></a>A.24.&nbsp;Version 2.0.3-release, 23 dec 2011</h2></div></div></div>
  12679. <h3><a name="idp35178576"></a>Bug fixes</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1031" target="_top">#1031</a>, SphinxQL parsing syntax for MVA at insert \ replace statements</p></li>
  12680. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1027" target="_top">#1027</a>, stalls on attribute update in high-concurrency load</p></li>
  12681. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1026" target="_top">#1026</a>, daemon crash on malformed API command</p></li>
  12682. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1021" target="_top">#1021</a>, <code class="code">max_children</code> option has been ignored with <code class="code">worker=threads</code></p></li>
  12683. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1020" target="_top">#1020</a>, crash on large attribute files loading</p></li>
  12684. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1014" target="_top">#1014</a>, crash on rotation when index has been removed from config file (<code class="code">worker=threads</code>, *nix box)</p></li>
  12685. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=1001" target="_top">#1001</a>, broken MVA files in RT index while saving disk chunk</p></li>
  12686. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=995" target="_top">#995</a>, crash on empty MVA updates</p></li>
  12687. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=994" target="_top">#994</a>, crash on daemon shutdown with <code class="code">seamless_rotate=0</code> and <code class="code">workers=threads</code></p></li>
  12688. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=993" target="_top">#993</a>, #998, crash on replay <code class="code">DELETE</code> statement vs RT index with <code class="code">dict=keywords</code>, fixed sequential <code class="code">INSERT</code> into <code class="code">dict=keywords</code> index right after <code class="code">INSERT</code> into <code class="code">dict=crc</code> index</p></li>
  12689. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=991" target="_top">#991</a>, crash on indexing mssql source with <code class="code">mssql_unicode</code> enabled</p></li>
  12690. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=983" target="_top">#983</a>, #950, crash on host name lookup (SphinxSE with MySQL 5.5)</p></li>
  12691. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=981" target="_top">#981</a>, snippet inconsistency with <code class="code">allow_empty=0</code></p></li>
  12692. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=980" target="_top">#980</a>, broken index produced by index merge in rare cases</p></li>
  12693. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=971" target="_top">#971</a>, absent error message at master on agent "maxed out"</p></li>
  12694. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=695" target="_top">#695</a>, #815, #835, #866, malformed warnings in SphinxQL</p></li>
  12695. <li class="listitem"><p>fixed build of SphinxSE with MySQL 5.1</p></li>
  12696. <li class="listitem"><p>fixed crash log for 'fork' and 'prefork' workers</p></li>
  12697. </ul></div></div>
  12698. <div class="sect1" title="A.25.&nbsp;Version 2.0.2-beta, 15 nov 2011"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel202"></a>A.25.&nbsp;Version 2.0.2-beta, 15 nov 2011</h2></div></div></div>
  12699. <h3><a name="idp35208192"></a>Major new features</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added keywords dictionary (<a class="link" href="#conf-dict" title="12.2.7.&nbsp;dict"><code class="code">dict=keywords</code></a>) support to RT indexes</p></li>
  12700. <li class="listitem"><p>added <a class="link" href="#conf-rt-attr-multi" title="12.2.55.&nbsp;rt_attr_multi">MVA</a>, <a class="link" href="#conf-index-exact-words" title="12.2.42.&nbsp;index_exact_words">index_exact_words</a> support to RT indexes (#888)</p></li>
  12701. <li class="listitem"><p>added <a class="link" href="#mva" title="3.4.&nbsp;MVA (multi-valued attributes)">MVA64</a> (a set of BIGINTs) support to both disk and RT indexes (<a class="link" href="#conf-rt-attr-multi-64" title="12.2.56.&nbsp;rt_attr_multi_64">rt_attr_multi_64</a> directive)</p></li>
  12702. <li class="listitem"><p>added an <a class="link" href="#expression-ranker" title="5.4.3.&nbsp;Expression based ranker (SPH_RANK_EXPR)">expression-based ranker</a>, and a number of new ranking factors</p></li>
  12703. <li class="listitem"><p>added <a class="link" href="#sphinxql-attach-index" title="8.25.&nbsp;ATTACH INDEX syntax">ATTACH INDEX</a> statement that converts a disk index to RT index</p></li>
  12704. <li class="listitem"><p>added <code class="code">WHERE</code> clause support to <a class="link" href="#sphinxql-update" title="8.23.&nbsp;UPDATE syntax">UPDATE</a> statement</p></li>
  12705. <li class="listitem"><p>added <code class="code">bigint</code>, <code class="code">float</code>, and <code class="code">MVA</code> attribute support to <a class="link" href="#sphinxql-update" title="8.23.&nbsp;UPDATE syntax">UPDATE</a> statement</p></li>
  12706. </ul></div>
  12707. <h3><a name="idp35222400"></a>New features</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added support for upto <a class="link" href="#fields" title="3.2.&nbsp;Full-text fields">256 searchable fields</a> (was upto 32 before)</p></li>
  12708. <li class="listitem"><p>added <a class="link" href="#expr-func-fibonacci"><code class="code">FIBONACCI()</code></a> function to <a class="link" href="#expressions" title="5.5.&nbsp;Expressions, functions, and operators">expressions</a></p></li>
  12709. <li class="listitem"><p>added <a class="link" href="#api-func-buildexcerpts" title="9.7.1.&nbsp;BuildExcerpts">load_files_scattered option</a> to snippets</p></li>
  12710. <li class="listitem"><p>added implicit attribute type promotions in multi-index result sets (#939)</p></li>
  12711. <li class="listitem"><p>added index names to <code class="filename">indexer</code> progress message on merge (#928)</p></li>
  12712. <li class="listitem"><p>added <a class="link" href="#ref-searchd" title="7.2.&nbsp;searchd command reference"><code class="option">--replay-flags</code></a> switch to <code class="filename">searchd</code></p></li>
  12713. <li class="listitem"><p>added string attribute support and a few previously missing <a class="link" href="#sphinxse-snippets" title="10.4.&nbsp;Building snippets (excerpts) via MySQL">snippets options</a> to SphinxSE</p></li>
  12714. <li class="listitem"><p>added previously missing <a class="link" href="#api-func-status" title="9.7.5.&nbsp;Status"><code class="code">Status()</code></a>, <a class="link" href="#api-func-setconnecttimeout" title="9.1.5.&nbsp;SetConnectTimeout"><code class="code">SetConnectTimeout()</code></a> API calls to Python API</p></li>
  12715. <li class="listitem"><p>added <code class="code">ORDER BY RAND()</code> support to <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">SELECT</a> statement</p></li>
  12716. <li class="listitem"><p>added Sphinx version to Windows crash log</p></li>
  12717. <li class="listitem"><p>added RT index support to <a class="link" href="#ref-indextool" title="7.4.&nbsp;indextool command reference">indextool</a> <code class="code">--check</code> (checks disk chunks only) (#877)</p></li>
  12718. <li class="listitem"><p>added <a class="link" href="#conf-prefork-rotation-throttle" title="12.4.37.&nbsp;prefork_rotation_throttle">prefork_rotation_throttle</a> directive (preforked children restart delay, in milliseconds) (#873)</p></li>
  12719. <li class="listitem"><p>added <a class="link" href="#conf-on-file-field-error" title="12.3.7.&nbsp;on_file_field_error">on_file_field_error</a> directive (different <code class="code">sql_file_field</code> handling modes)</p></li>
  12720. <li class="listitem"><p>added manpages for all the programs</p></li>
  12721. <li class="listitem"><p>added syslog logging support</p></li>
  12722. <li class="listitem"><p>added sentence, paragraph, and zone support in <code class="code">html_strip_mode=retain</code> mode to snippets</p></li>
  12723. <li class="listitem"><p>optimized search performance with many <code class="code">ZONE</code> operators</p></li>
  12724. <li class="listitem"><p>improved suggestion tool (added Levenshtein limit, removed extra DB fetch)</p></li>
  12725. <li class="listitem"><p>improved <a class="link" href="#conf-index-sp" title="12.2.8.&nbsp;index_sp">sentence extraction</a> (handles salutations, starting initials better now)</p></li>
  12726. <li class="listitem"><p>changed <a class="link" href="#conf-max-filter-values" title="12.4.16.&nbsp;max_filter_values">max_filter_values</a> sanity check to 10M values</p></li>
  12727. </ul></div>
  12728. <h3><a name="idp35250832"></a>New SphinxQL features</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added <a class="link" href="#sphinxql-flush-rtindex" title="8.26.&nbsp;FLUSH RTINDEX syntax">FLUSH RTINDEX</a> statement</p></li>
  12729. <li class="listitem"><p>added <code class="code">dist_threads</code> directive (parallel processing), <code class="code">load_files</code>, <code class="code">load_files_scattered</code>, batch syntax (multiple documents) support to <a class="link" href="#sphinxql-call-snippets" title="8.14.&nbsp;CALL SNIPPETS syntax">CALL SNIPPETS</a> statement</p></li>
  12730. <li class="listitem"><p>added <code class="code">OPTION comment='...'</code> support to <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">SELECT</a> statement (#944)</p></li>
  12731. <li class="listitem"><p>added <a class="link" href="#sphinxql-show-variables" title="8.20.&nbsp;SHOW VARIABLES syntax">SHOW VARIABLES</a> statement</p></li>
  12732. <li class="listitem"><p>added dummy handlers for <a class="link" href="#sphinxql-set-transaction" title="8.10.&nbsp;SET TRANSACTION syntax">SET TRANSACTION</a>, <a class="link" href="#sphinxql-set" title="8.9.&nbsp;SET syntax">SET NAMES</a>, <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">SELECT @@sysvar</a> statements, and for <code class="code">sql_auto_is_null</code>, <code class="code">sql_mode</code>, and @@-style variables (like @@tx_isolation) in <a class="link" href="#sphinxql-set" title="8.9.&nbsp;SET syntax">SET</a> statement (better MySQL frameworks/connectors support)</p></li>
  12733. <li class="listitem"><p>added complete <a class="link" href="#sphinxql-log-format" title="5.9.2.&nbsp;SphinxQL log format">SphinxQL error logging</a> (all errors are logged now, not just <code class="code">SELECT</code>s)</p></li>
  12734. <li class="listitem"><p>improved <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">SELECT</a> statement syntax, made expressions aliases optional</p></li>
  12735. </ul></div>
  12736. <h3><a name="idp35267216"></a>Bug fixes</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=982" target="_top">#982</a>, empty binlogs prevented upgraded daemon from starting up</p></li>
  12737. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=978" target="_top">#978</a>, libsphinxclient build failed on sparc/sparc64 solaris</p></li>
  12738. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=977" target="_top">#977</a>, eliminated (most) compiler warnings</p></li>
  12739. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=969" target="_top">#969</a>, broken expression MVA/string argument type check prevented IF(IN(mva..)) and other valid expressions from working</p></li>
  12740. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=966" target="_top">#966</a>, NOT IN @global_var syntax was not supported</p></li>
  12741. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=958" target="_top">#958</a>, mem_limit over INT_MAX was not clamped</p></li>
  12742. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=954" target="_top">#954</a>, UTF-8 snippets could crash on malformed data</p></li>
  12743. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=951" target="_top">#951</a>, UTF-8 snippets could hang on malformed data</p></li>
  12744. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=947" target="_top">#947</a>, bad float column type was reported via SphinxQL, breaking some clients</p></li>
  12745. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=940" target="_top">#940</a>, group-by with a small enough <code class="code">max_matches</code> limit could occasionaly crash and/or sort wrongly</p></li>
  12746. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=932" target="_top">#932</a>, sending huge queries to agents occasionally failed (mainly on Windows)</p></li>
  12747. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=926" target="_top">#926</a>, snippets did not highlight widlcard matches with morphology enabled</p></li>
  12748. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=918" target="_top">#918</a>, crash logger did not report a proper query in <code class="code">dist_threads</code> case</p></li>
  12749. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=916" target="_top">#916</a>, watchdog caused (endless) respawns if there was a crash during shutdown</p></li>
  12750. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=904" target="_top">#904</a>, attribute names were not forcibly case-folded in some API calls (eg. <code class="code">SetGroupDistinct</code>)</p></li>
  12751. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=902" target="_top">#902</a>, query parser did not support <code class="code">stopword_step=0</code></p></li>
  12752. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=897" target="_top">#897</a>, network sockets dangled (open but unattended) while replaying binlog</p></li>
  12753. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=855" target="_top">#855</a>, <code class="code">allow_empty</code> option in snippets did not always work correctly</p></li>
  12754. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=854" target="_top">#854</a>, indexing with many <code class="code">bigint</code> attributes and <code class="code">docinfo=inline</code> crashed</p></li>
  12755. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=838" target="_top">#838</a>, RT MVA insertion did not sort MVA values, caused matching issues</p></li>
  12756. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=833" target="_top">#833</a>, duplicate MVA values were not eliminated on update</p></li>
  12757. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=832" target="_top">#832</a>, certain (overshort/incorrect) documents crashed indexing MS SQL Unicode columns</p></li>
  12758. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=829" target="_top">#829</a>, query parser did not properly handle numerics with <code class="code">blend_chars</code></p></li>
  12759. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=814" target="_top">#814</a>, group-by string attributes in RT indexes dit not always work correctly</p></li>
  12760. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=812" target="_top">#812</a>, utf8 stemming produced unexpected stems on words with single-byte chars</p></li>
  12761. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=808" target="_top">#808</a>, huge queries crashed logging with <code class="code">query_log_format=sphinxql</code></p></li>
  12762. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=806" target="_top">#806</a>, stray single-star keyword crashed on querying</p></li>
  12763. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=798" target="_top">#798</a>, snippets ignored <code class="code">index_exact_words</code> in query_mode</p></li>
  12764. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=797" target="_top">#797</a>, RT klist loader had an occasional off-by-one crash</p></li>
  12765. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=791" target="_top">#791</a>, <code class="code">preopen_indexes</code> erroneously defaulted to 0 on Windows</p></li>
  12766. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=790" target="_top">#790</a>, huge dictionaries (over 4 GB) did not work</p></li>
  12767. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=786" target="_top">#786</a>, <code class="code">inplace_enable</code> could occasionally corrupt the indexes</p></li>
  12768. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=775" target="_top">#775</a>, doc had a typo (soundex vs metaphone)</p></li>
  12769. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=772" target="_top">#772</a>, snippets duplicated blended chars on a SPZ boundary</p></li>
  12770. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=762" target="_top">#762</a>, query parser truncated digit-only keywords over 15 digits</p></li>
  12771. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=736" target="_top">#736</a>, query parser dit not properly handle blended/special char sequence</p></li>
  12772. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=726" target="_top">#726</a>, rotation of an index with a changed attribute count crashed</p></li>
  12773. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=687" target="_top">#687</a>, querying multiple indexes with index weights and sort-by expression produced incorrect (unadjusted) weights</p></li>
  12774. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=585" target="_top">#585</a>, (unsupported) string ordinals were silently zeroed out with <code class="code">docinfo=inline</code> (instead of failing)</p></li>
  12775. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=583" target="_top">#583</a>, certain keywords could occasionally crash multiforms</p></li>
  12776. <li class="listitem"><p>fixed that concurrent MVA updates could crash</p></li>
  12777. <li class="listitem"><p>fixed that query parser did not ignore a pure blended token with a leading modifier</p></li>
  12778. <li class="listitem"><p>fixed that query parser did not properly handle a modifier followed by a dash</p></li>
  12779. <li class="listitem"><p>fixed that substring indexing with <code class="code">dict=crc</code> did not support <code class="code">index_exact_words</code> and <code class="code">zones</code></p></li>
  12780. <li class="listitem"><p>fixed that in a rare edge case common subtree cache could crash</p></li>
  12781. <li class="listitem"><p>fixed that empty result set returned the full schema (rather than <code class="code">SELECT</code>-ed columns)</p></li>
  12782. <li class="listitem"><p>fixed that SphinxQL did not have a sanity check for (currently unsupported) result set schemas over 250 attributes</p></li>
  12783. <li class="listitem"><p>fixed that updates on regular indexes were not binlogged</p></li>
  12784. <li class="listitem"><p>fixed that multi-query optimization check for expressions did not handle multi-index case</p></li>
  12785. <li class="listitem"><p>fixed that SphinxSE did not build vs MySQL 5.5 release</p></li>
  12786. <li class="listitem"><p>fixed that <code class="code">proximity_bm25</code> ranker could yield incorrect weight on duplicated keywords</p></li>
  12787. <li class="listitem"><p>fixed that prefix expansion with <code class="code">dict=keyword</code> occasionally crashed</p></li>
  12788. <li class="listitem"><p>fixed that <code class="code">strip_path</code> did not work on RT disk chunks</p></li>
  12789. <li class="listitem"><p>fixed that exclude filters were not properly logged in <code class="code">query_log_format=sphinxql</code> mode</p></li>
  12790. <li class="listitem"><p>fixed that plain string attribute check in <code class="filename">indextool</code> <code class="code">--check</code> was broken</p></li>
  12791. <li class="listitem"><p>fixed that Java API did not let specify a connection timeout</p></li>
  12792. <li class="listitem"><p>fixed that ordinal and wordcount attributes could not be fetched via SphinxQL</p></li>
  12793. <li class="listitem"><p>fixed that in a rare edge case <code class="code">OR/ORDER</code> would not match properly</p></li>
  12794. <li class="listitem"><p>fixed that sending (huge) query response did not handle <code class="code">EINTR</code> properly</p></li>
  12795. <li class="listitem"><p>fixed that <code class="code">SPH04</code> ranker could yield incorrectly high weight in some cases</p></li>
  12796. <li class="listitem"><p>fixed that C API did not let zero out cutoff, <code class="code">max_matches</code> settings</p></li>
  12797. <li class="listitem"><p>fixed that on a persistent connection there were occasionally issues handling signals while doing network reads/waitss</p></li>
  12798. <li class="listitem"><p>fixed that in a rare edge case (field start modifier in a certain complex query) querying crashed</p></li>
  12799. <li class="listitem"><p>fixed that snippets did not support <code class="code">dist_threads</code> with <code class="code">load_files=0</code></p></li>
  12800. <li class="listitem"><p>fixed that in some extremely rare edge cases tiny parts of an index could end up corrupted with <code class="code">dict=keywords</code></p></li>
  12801. <li class="listitem"><p>fixed that field/zone conditions were not propagated to expanded keywords with <code class="code">dict=keywords</code></p></li>
  12802. </ul></div></div>
  12803. <div class="sect1" title="A.26.&nbsp;Version 2.0.1-beta, 22 apr 2011"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel201"></a>A.26.&nbsp;Version 2.0.1-beta, 22 apr 2011</h2></div></div></div>
  12804. <h3><a name="idp35350992"></a>New general features</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added remapping support to <a class="link" href="#conf-blend-chars" title="12.2.47.&nbsp;blend_chars">blend_chars</a> directive</p></li>
  12805. <li class="listitem"><p>added multi-threaded snippet batches support (requires a batch sent via API, <a class="link" href="#conf-dist-threads" title="12.4.24.&nbsp;dist_threads">dist_threads</a>, and <code class="code">load_files</code>)</p></li>
  12806. <li class="listitem"><p>added collations (<a class="link" href="#conf-collation-server" title="12.4.29.&nbsp;collation_server">collation_server</a>, <a class="link" href="#conf-collation-libc-locale" title="12.4.30.&nbsp;collation_libc_locale">collation_libc_locale directives</a>)</p></li>
  12807. <li class="listitem"><p>added support for sorting and grouping on string attributes (<code class="code">ORDER BY</code>, <code class="code">GROUP BY</code>, <code class="code">WITHIN GROUP ORDER BY</code>)</p></li>
  12808. <li class="listitem"><p>added UDF support (<a class="link" href="#conf-plugin-dir" title="12.4.31.&nbsp;plugin_dir">plugin_dir</a> directive; <a class="link" href="#sphinxql-create-function" title="8.18.&nbsp;CREATE FUNCTION syntax">CREATE FUNCTION</a>, <a class="link" href="#sphinxql-drop-function" title="8.19.&nbsp;DROP FUNCTION syntax">DROP FUNCTION</a> statements)</p></li>
  12809. <li class="listitem"><p>added <a class="link" href="#conf-query-log-format" title="12.4.4.&nbsp;query_log_format">query_log_format</a> directive, <a class="link" href="#sphinxql-set" title="8.9.&nbsp;SET syntax">SET GLOBAL query_log_format | log_level = ...</a> statements; and connection id tracking</p></li>
  12810. <li class="listitem"><p>added <a class="link" href="#conf-sql-column-buffers" title="12.1.25.&nbsp;sql_column_buffers">sql_column_buffers</a> directive, fixed out-of-buffer column handling in ODBC/MS SQL sources</p></li>
  12811. <li class="listitem"><p>added <a class="link" href="#conf-blend-mode" title="12.2.48.&nbsp;blend_mode">blend_mode</a> directive that enables indexing multiple variants of a blended sequence</p></li>
  12812. <li class="listitem"><p>added UNIX socket support to C, Ruby APIs</p></li>
  12813. <li class="listitem"><p>added ranged query support to <a class="link" href="#conf-sql-joined-field" title="12.1.13.&nbsp;sql_joined_field">sql_joined_field</a></p></li>
  12814. <li class="listitem"><p>added <a class="link" href="#conf-rt-flush-period" title="12.4.33.&nbsp;rt_flush_period">rt_flush_period</a> directive</p></li>
  12815. <li class="listitem"><p>added <a class="link" href="#conf-thread-stack" title="12.4.34.&nbsp;thread_stack">thread_stack</a> directive</p></li>
  12816. <li class="listitem"><p>added SENTENCE, PARAGRAPH, ZONE operators (and <a class="link" href="#conf-index-sp" title="12.2.8.&nbsp;index_sp">index_sp</a>, <a class="link" href="#conf-index-zones" title="12.2.9.&nbsp;index_zones">index_zones</a> directives)</p></li>
  12817. <li class="listitem"><p>added keywords dictionary support (and <a class="link" href="#conf-dict" title="12.2.7.&nbsp;dict">dict</a>, <a class="link" href="#conf-expansion-limit" title="12.4.35.&nbsp;expansion_limit">expansion_limit</a> directives)</p></li>
  12818. <li class="listitem"><p>added <code class="code">passage_boundary</code>, <code class="code">emit_zones</code> options to snippets</p></li>
  12819. <li class="listitem"><p>added <a class="link" href="#conf-watchdog" title="12.4.36.&nbsp;watchdog">a watchdog process</a> in threaded mode</p></li>
  12820. <li class="listitem"><p>added persistent MVA updates</p></li>
  12821. <li class="listitem"><p>added crash dumps to <code class="filename">searchd.log</code>, deprecated <code class="code">crash_log_path</code> directive</p></li>
  12822. <li class="listitem"><p>added id32 index support in id64 binaries (EXPERIMENTAL)</p></li>
  12823. <li class="listitem"><p>added SphinxSE support for DELETE and REPLACE on SphinxQL tables</p></li>
  12824. </ul></div>
  12825. <h3><a name="idp35382784"></a>New SphinxQL features</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added new, more SQL compliant SphinxQL syntax; and a compat_sphinxql_magics directive</p></li>
  12826. <li class="listitem"><p>added <a class="link" href="#expr-func-crc32">CRC32()</a>, <a class="link" href="#expr-func-day">DAY()</a>, <a class="link" href="#expr-func-month">MONTH()</a>, <a class="link" href="#expr-func-year">YEAR()</a>, <a class="link" href="#expr-func-yearmonth">YEARMONTH()</a>, <a class="link" href="#expr-func-yearmonthday">YEARMONTHDAY()</a> functions</p></li>
  12827. <li class="listitem"><p>added <a class="link" href="#expr-ari-ops">DIV, MOD, and % operators</a></p></li>
  12828. <li class="listitem"><p>added <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">reverse_scan=(0|1)</a> option to SELECT</p></li>
  12829. <li class="listitem"><p>added support for MySQL packets over 16M</p></li>
  12830. <li class="listitem"><p>added dummy SHOW VARIABLES, SHOW COLLATION, and SET character_set_results support (to support handshake with certain client libraries and frameworks)</p></li>
  12831. <li class="listitem"><p>added <a class="link" href="#conf-mysql-version-string" title="12.4.32.&nbsp;mysql_version_string">mysql_version_string</a> directive (to workaround picky MySQL client libraries)</p></li>
  12832. <li class="listitem"><p>added support for global filter variables, <a class="link" href="#sphinxql-set" title="8.9.&nbsp;SET syntax">SET GLOBAL @uservar=(int_list)</a> </p></li>
  12833. <li class="listitem"><p>added <a class="link" href="#sphinxql-delete" title="8.8.&nbsp;DELETE syntax">DELETE ... IN (id_list)</a> syntax support</p></li>
  12834. <li class="listitem"><p>added C-style comments syntax (for example, <code class="code">SELECT /*!40000 some comment*/ id FROM test</code>)</p></li>
  12835. <li class="listitem"><p>added <a class="link" href="#sphinxql-update" title="8.23.&nbsp;UPDATE syntax">UPDATE ... WHERE id=X</a> syntax support</p></li>
  12836. <li class="listitem"><p>added <a class="link" href="#sphinxql-multi-queries" title="8.40.&nbsp;Multi-statement queries">SphinxQL multi-query support</a></p></li>
  12837. <li class="listitem"><p>added <a class="link" href="#sphinxql-describe" title="8.17.&nbsp;DESCRIBE syntax">DESCRIBE</a>, <a class="link" href="#sphinxql-show-tables" title="8.16.&nbsp;SHOW TABLES syntax">SHOW TABLES</a> statements</p></li>
  12838. </ul></div>
  12839. <h3><a name="idp35403696"></a>New command-line switches</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added <code class="code">--print-queries</code> switch to <code class="filename">indexer</code> that dumps SQL queries it runs</p></li>
  12840. <li class="listitem"><p>added <code class="code">--sighup-each </code> switch to <code class="filename">indexer</code> that rotates indexes one by one</p></li>
  12841. <li class="listitem"><p>added <code class="code">--strip-path</code> switch to <code class="filename">searchd</code> that skips file paths embedded in the index(-es)</p></li>
  12842. <li class="listitem"><p>added <code class="code">--dumpconfig</code> switch to <code class="filename">indextool</code> that dumps an index header in <code class="filename">sphinx.conf</code> format</p></li>
  12843. </ul></div>
  12844. <h3><a name="idp35412160"></a>Major changes and optimizations</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>changed default preopen_indexes value to 1</p></li>
  12845. <li class="listitem"><p>optimized English stemmer (results in 1.3x faster snippets and indexing with morphology=stem_en)</p></li>
  12846. <li class="listitem"><p>optimized snippets, 1.6x general speedup</p></li>
  12847. <li class="listitem"><p>optimized const-list parsing in SphinxQL</p></li>
  12848. <li class="listitem"><p>optimized full-document highlighting CPU/RAM use</p></li>
  12849. <li class="listitem"><p>optimized binlog replay (improved performance on K-list update)</p></li>
  12850. </ul></div>
  12851. <h3><a name="idp35416496"></a>Bug fixes</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=767" target="_top">#767</a>, joined fields vs ODBC sources</p></li>
  12852. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=757" target="_top">#757</a>, wordforms shared by indexes with different settings</p></li>
  12853. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=733" target="_top">#733</a>, loading of indexes in formats prior to v.14</p></li>
  12854. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=763" target="_top">#763</a>, occasional snippets failures</p></li>
  12855. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=648" target="_top">#648</a>, occasionally missed rotations on multiple SIGHUPs</p></li>
  12856. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=750" target="_top">#750</a>, an RT segment merge leading to false positives and/or crashes in some cases</p></li>
  12857. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=755" target="_top">#755</a>, zones in snippets output</p></li>
  12858. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=754" target="_top">#754</a>, stopwords counting at snippet passage generation</p></li>
  12859. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=723" target="_top">#723</a>, fork/prefork index rotation in children processes</p></li>
  12860. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=696" target="_top">#696</a>, freeze on zero threshold in quorum operator</p></li>
  12861. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=732" target="_top">#732</a>, query escaping in SphinxSE</p></li>
  12862. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=739" target="_top">#739</a>, occasional crashes in MT mode on result set send</p></li>
  12863. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=746" target="_top">#746</a>, crash with a named list in SphinxQL option</p></li>
  12864. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=674" target="_top">#674</a>, AVG vs group order</p></li>
  12865. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=734" target="_top">#734</a>, occasional crashes attempting to report NULL errors</p></li>
  12866. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=829" target="_top">#829</a>, tail hits within field position modifier</p></li>
  12867. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=712" target="_top">#712</a>, missing query_mode, force_all_words snippet option defaults in Java API</p></li>
  12868. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=721" target="_top">#721</a>, added dupe removal on RT batch INSERT/REPLACE</p></li>
  12869. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=720" target="_top">#720</a>, potential extraneous highlighting after a blended keyword</p></li>
  12870. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=702" target="_top">#702</a>, exceptions vs star search</p></li>
  12871. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=666" target="_top">#666</a>, ext2 query grouping vs exceptions</p></li>
  12872. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=688" target="_top">#688</a>, WITHIN GROUP ORDER BY related crash</p></li>
  12873. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=660" target="_top">#660</a>, multi-queue batches vs dist_threads</p></li>
  12874. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=678" target="_top">#678</a>, crash on dict=keywords vs xmlpipe vs min_prefix_len</p></li>
  12875. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=596" target="_top">#596</a>, ECHILD vs scripted configs</p></li>
  12876. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=653" target="_top">#653</a>, dependency in expression, sorting, grouping</p></li>
  12877. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=661" target="_top">#661</a>, concurrent distributed searches vs workers=threads</p></li>
  12878. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=646" target="_top">#646</a>, crash on status query via UNIX socket</p></li>
  12879. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=589" target="_top">#589</a>, libexpat.dll missing from some Win32 build types</p></li>
  12880. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=574" target="_top">#574</a>, quorum match order</p></li>
  12881. <li class="listitem"><p>fixed multiple documentation issues (#372, #483, #495, #601, #623, #632, #654)</p></li>
  12882. <li class="listitem"><p>fixed that ondisk_dict did not affect RT indexes</p></li>
  12883. <li class="listitem"><p>fixed that string attributes check in indextool --check was erroneously sensitive to string data order</p></li>
  12884. <li class="listitem"><p>fixed a rare crash when using BEFORE operator</p></li>
  12885. <li class="listitem"><p>fixed an issue with multiforms vs BuildKeywords()</p></li>
  12886. <li class="listitem"><p>fixed an edge case in OR operator (emitted wrong hits order sometimes)</p></li>
  12887. <li class="listitem"><p>fixed aliasing in docinfo accessors that lead to very rare crashes and/or missing results</p></li>
  12888. <li class="listitem"><p>fixed a syntax error on a short token at the end of a query</p></li>
  12889. <li class="listitem"><p>fixed id64 filtering and performance degradation with range filters</p></li>
  12890. <li class="listitem"><p>fixed missing rankers in libsphinxclient</p></li>
  12891. <li class="listitem"><p>fixed missing SPH04 ranker in SphinxSE</p></li>
  12892. <li class="listitem"><p>fixed column names in sql_attr_multi sample (works with example.sql now)</p></li>
  12893. <li class="listitem"><p>fixed an issue with distributed local+remote setup vs aggregate functions</p></li>
  12894. <li class="listitem"><p>fixed case sensitive columns names in RT indexes</p></li>
  12895. <li class="listitem"><p>fixed a crash vs strings from multiple indexes in result set</p></li>
  12896. <li class="listitem"><p>fixed blended keywords vs snippets</p></li>
  12897. <li class="listitem"><p>fixed secure_connection vs MySQL protocol vs MySQL.NET connector</p></li>
  12898. <li class="listitem"><p>fixed that Python API did not works with Python 2.3</p></li>
  12899. <li class="listitem"><p>fixed overshort_step vs snippets</p></li>
  12900. <li class="listitem"><p>fixed keyword staistics vs dist_threads searching</p></li>
  12901. <li class="listitem"><p>fixed multiforms vs query parsing (vs quorum)</p></li>
  12902. <li class="listitem"><p>fixed missed quorum words vs RT segments</p></li>
  12903. <li class="listitem"><p>fixed blended keywords occasionally skipping extra character when querying (eg "abc[]")</p></li>
  12904. <li class="listitem"><p>fixed Python API to handle int32 values</p></li>
  12905. <li class="listitem"><p>fixed prefix and infix indexing of joined fields</p></li>
  12906. <li class="listitem"><p>fixed MVA ranged query</p></li>
  12907. <li class="listitem"><p>fixed missing blended state reset on document boundary</p></li>
  12908. <li class="listitem"><p>fixed a crash on missing index while replaying binlog</p></li>
  12909. <li class="listitem"><p>fixed an error message on filter values overrun</p></li>
  12910. <li class="listitem"><p>fixed passage duplication in snippets in weight_order mode</p></li>
  12911. <li class="listitem"><p>fixed select clauses over 1K vs remote agents</p></li>
  12912. <li class="listitem"><p>fixed overshort accounting vs soft-whitespace tokens</p></li>
  12913. <li class="listitem"><p>fixed rotation vs workers=threads</p></li>
  12914. <li class="listitem"><p>fixed schema issues vs distributed indexes</p></li>
  12915. <li class="listitem"><p>fixed blended-escaped sequence parsing issue</p></li>
  12916. <li class="listitem"><p>fixed MySQL IN clause (values order etc)</p></li>
  12917. <li class="listitem"><p>fixed that post_index did not execute when 0 documents were succesfully indexed</p></li>
  12918. <li class="listitem"><p>fixed field position limit vs many hits</p></li>
  12919. <li class="listitem"><p>fixed that joined fields missed an end marker at field end</p></li>
  12920. <li class="listitem"><p>fixed that xxx_step settings were missing from .sph index header</p></li>
  12921. <li class="listitem"><p>fixed libsphinxclient missing request cleanup in sphinx_query() (eg after network errors)</p></li>
  12922. <li class="listitem"><p>fixed that index_weights were ignored when grouping</p></li>
  12923. <li class="listitem"><p>fixed multi wordforms vs blend_chars</p></li>
  12924. <li class="listitem"><p>fixed broken MVA output in SphinxQL</p></li>
  12925. <li class="listitem"><p>fixed a few RT leaks</p></li>
  12926. <li class="listitem"><p>fixed an issue with RT string storage going missing</p></li>
  12927. <li class="listitem"><p>fixed an issue with repeated queries vs dist_threads</p></li>
  12928. <li class="listitem"><p>fixed an issue with string attributes vs buffer overrun in SphinxQL</p></li>
  12929. <li class="listitem"><p>fixed unexpected character data warnings within ignored xmlpipe tags</p></li>
  12930. <li class="listitem"><p>fixed a crash in snippets with NEAR syntax query</p></li>
  12931. <li class="listitem"><p>fixed passage duplication in snippets</p></li>
  12932. <li class="listitem"><p>fixed libsphinxclient SIGPIPE handling</p></li>
  12933. <li class="listitem"><p>fixed libsphinxclient vs VS2003 compiler bug</p></li>
  12934. </ul></div></div>
  12935. <div class="sect1" title="A.27.&nbsp;Version 1.10-beta, 19 jul 2010"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel110"></a>A.27.&nbsp;Version 1.10-beta, 19 jul 2010</h2></div></div></div>
  12936. <div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added RT indexes support (<a class="xref" href="#rt-indexes" title="Chapter&nbsp;4.&nbsp;Real-time indexes">Chapter&nbsp;4, <i>Real-time indexes</i></a>)</p></li>
  12937. <li class="listitem"><p>added prefork and threads support (<a class="link" href="#conf-workers" title="12.4.23.&nbsp;workers">workers</a> directives)</p></li>
  12938. <li class="listitem"><p>added multi-threaded local searches in distributed indexes (<a class="link" href="#conf-dist-threads" title="12.4.24.&nbsp;dist_threads">dist_threads</a> directive)</p></li>
  12939. <li class="listitem"><p>added common subquery cache (<a class="link" href="#conf-subtree-docs-cache" title="12.4.21.&nbsp;subtree_docs_cache">subtree_docs_cache</a>,
  12940. <a class="link" href="#conf-subtree-hits-cache" title="12.4.22.&nbsp;subtree_hits_cache">subtree_hits_cache</a> directives)</p></li>
  12941. <li class="listitem"><p>added string attributes support (<a class="link" href="#conf-sql-attr-string" title="12.1.23.&nbsp;sql_attr_string">sql_attr_string</a>,
  12942. <a class="link" href="#conf-sql-field-string" title="12.1.26.&nbsp;sql_field_string">sql_field_string</a>,
  12943. <a class="link" href="#conf-xmlpipe-attr-string" title="12.1.41.&nbsp;xmlpipe_attr_string">xml_attr_string</a>,
  12944. <a class="link" href="#conf-xmlpipe-field-string" title="12.1.33.&nbsp;xmlpipe_field_string">xml_field_string</a> directives)</p></li>
  12945. <li class="listitem"><p>added indexing-time word counter (<code class="option">sql_attr_str2wordcount</code>,
  12946. <code class="option">sql_field_str2wordcount</code> directives)</p></li>
  12947. <li class="listitem"><p>added <a class="link" href="#sphinxql-call-snippets" title="8.14.&nbsp;CALL SNIPPETS syntax">CALL SNIPPETS()</a>,
  12948. <a class="link" href="#sphinxql-call-keywords" title="8.15.&nbsp;CALL KEYWORDS syntax">CALL KEYWORDS()</a> SphinxQL statements</p></li>
  12949. <li class="listitem"><p>added <code class="option">field_weights</code>, <code class="option">index_weights</code> options to
  12950. SphinxQL <a class="link" href="#sphinxql-select" title="8.1.&nbsp;SELECT syntax">SELECT</a> statement</p></li>
  12951. <li class="listitem"><p>added insert-only SphinxQL-talking tables to SphinxSE (connection='sphinxql://host[:port]/index')</p></li>
  12952. <li class="listitem"><p>added <code class="option">select</code> option to SphinxSE queries</p></li>
  12953. <li class="listitem"><p>added backtrace on crash to <code class="filename">searchd</code></p></li>
  12954. <li class="listitem"><p>added SQL+FS indexing, aka loading files by names fetched from SQL
  12955. (<a class="link" href="#conf-sql-file-field" title="12.1.27.&nbsp;sql_file_field">sql_file_field</a> directive)</p></li>
  12956. <li class="listitem"><p>added a watchdog in threads mode to <code class="filename">searchd</code></p></li>
  12957. <li class="listitem"><p>added automatic row phantoms elimination to index merge</p></li>
  12958. <li class="listitem"><p>added hitless indexing support (hitless_words directive)</p></li>
  12959. <li class="listitem"><p>added --check, --strip-path, --htmlstrip, --dumphitlist ... --wordid switches to <a class="link" href="#ref-indextool" title="7.4.&nbsp;indextool command reference">indextool</a></p></li>
  12960. <li class="listitem"><p>added --stopwait, --logdebug switches to <a class="link" href="#ref-searchd" title="7.2.&nbsp;searchd command reference">searchd</a></p></li>
  12961. <li class="listitem"><p>added --dump-rows, --verbose switches to <a class="link" href="#ref-indexer" title="7.1.&nbsp;indexer command reference">indexer</a></p></li>
  12962. <li class="listitem"><p>added "blended" characters indexing support (<a class="link" href="#conf-blend-chars" title="12.2.47.&nbsp;blend_chars">blend_chars</a> directive)</p></li>
  12963. <li class="listitem"><p>added joined/payload field indexing (<a class="link" href="#conf-sql-joined-field" title="12.1.13.&nbsp;sql_joined_field">sql_joined_field</a> directive)</p></li>
  12964. <li class="listitem"><p>added <a class="link" href="#api-func-flushattributes" title="9.7.6.&nbsp;FlushAttributes">FlushAttributes() API call</a></p></li>
  12965. <li class="listitem"><p>added query_mode, force_all_words, limit_passages, limit_words, start_passage_id, load_files, html_strip_mode,
  12966. allow_empty options, and %PASSAGE_ID% macro in before_match, after_match options
  12967. to <a class="link" href="#api-func-buildexcerpts" title="9.7.1.&nbsp;BuildExcerpts">BuildExcerpts()</a> API call</p></li>
  12968. <li class="listitem"><p>added @groupby/@count/@distinct columns support to SELECT (but not to expressions)</p></li>
  12969. <li class="listitem"><p>added query-time keyword expansion support (<a class="link" href="#conf-expand-keywords" title="12.2.46.&nbsp;expand_keywords">expand_keywords</a> directive,
  12970. <a class="link" href="#api-func-setrankingmode" title="9.3.2.&nbsp;SetRankingMode">SPH_RANK_SPH04</a> ranker)</p></li>
  12971. <li class="listitem"><p>added query batch size limit option (<a class="link" href="#conf-max-batch-queries" title="12.4.20.&nbsp;max_batch_queries">max_batch_queries</a> directive; was hardcoded)</p></li>
  12972. <li class="listitem"><p>added SINT() function to expressions</p></li>
  12973. <li class="listitem"><p>improved SphinxQL syntax error reporting</p></li>
  12974. <li class="listitem"><p>improved expression optimizer (better constant handling)</p></li>
  12975. <li class="listitem"><p>improved dash handling within keywords (no longer treated as an operator)</p></li>
  12976. <li class="listitem"><p>improved snippets (better passage selection/trimming, around option now a hard limit)</p></li>
  12977. <li class="listitem"><p>optimized index format that yields ~20-30% smaller indexes</p></li>
  12978. <li class="listitem"><p>optimized sorting code (indexing time 1-5% faster on average; 100x faster in worst case)</p></li>
  12979. <li class="listitem"><p>optimized searchd startup time (moved .spa preindexing to indexer), added a progress bar</p></li>
  12980. <li class="listitem"><p>optimized queries against indexes with many attributes (eliminated redundant copying)</p></li>
  12981. <li class="listitem"><p>optimized 1-keyword queries (performace regression introduced in 0.9.9)</p></li>
  12982. <li class="listitem"><p>optimized SphinxQL protocol overheads, and performance on bigger result sets</p></li>
  12983. <li class="listitem"><p>optimized unbuffered attributes writes on index merge</p></li>
  12984. <li class="listitem"><p>changed attribute handling, duplicate names are strictly forbidden now</p></li>
  12985. <li class="listitem"><p>fixed that SphinxQL sessions could stall shutdown</p></li>
  12986. <li class="listitem"><p>fixed consts with leading minus in SphinxQL</p></li>
  12987. <li class="listitem"><p>fixed AND/OR precedence in expressions</p></li>
  12988. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=334" target="_top">#334</a>, AVG() on integers was not computed in floats</p></li>
  12989. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=371" target="_top">#371</a>, attribute flush vs 2+ GB files</p></li>
  12990. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=373" target="_top">#373</a>, segfault on distributed queries vs certain libc versions</p></li>
  12991. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=398" target="_top">#398</a>, stopwords not stopped in prefix/infix indexes</p></li>
  12992. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=404" target="_top">#404</a>, erroneous MVA failures in indextool --check</p></li>
  12993. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=408" target="_top">#408</a>, segfault on certain query batches (regular scan, plus a scan with MVA groupby)</p></li>
  12994. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=431" target="_top">#431</a>, occasional shutdown hangs in preforked workers</p></li>
  12995. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=436" target="_top">#436</a>, trunk checkout builds vs Solaris sh</p></li>
  12996. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=440" target="_top">#440</a>, escaping vs parentheses declared as valid in charset_table</p></li>
  12997. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=442" target="_top">#442</a>, occasional non-aligned free in MVA indexing</p></li>
  12998. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=447" target="_top">#447</a>, occasional crashes in MVA indexing</p></li>
  12999. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=449" target="_top">#449</a>, pconn busyloop on aborted clients on certain arches</p></li>
  13000. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=465" target="_top">#465</a>, build issue on Alpha</p></li>
  13001. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=468" target="_top">#468</a>, build issue in libsphinxclient</p></li>
  13002. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=472" target="_top">#472</a>, multiple stopword files failing to load</p></li>
  13003. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=489" target="_top">#489</a>, buffer overflow in query logging</p></li>
  13004. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=493" target="_top">#493</a>, Python API assertion after error returned from Query()</p></li>
  13005. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=500" target="_top">#500</a>, malformed MySQL packet when sending MVAs</p></li>
  13006. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=504" target="_top">#504</a>, SIGPIPE in libsphinxclient</p></li>
  13007. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=506" target="_top">#506</a>, better MySQL protocol commands support in SphinxQL (PING etc)</p></li>
  13008. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=509" target="_top">#509</a>, indexing ranged results from stored procedures</p></li>
  13009. </ul></div></div>
  13010. <div class="sect1" title="A.28.&nbsp;Version 0.9.9-release, 02 dec 2009"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel099"></a>A.28.&nbsp;Version 0.9.9-release, 02 dec 2009</h2></div></div></div>
  13011. <div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added Open, Close, Status calls to libsphinxclient (C API)</p></li>
  13012. <li class="listitem"><p>added automatic persistent connection reopening to PHP, Python APIs</p></li>
  13013. <li class="listitem"><p>added 64-bit value/range filters, fullscan mode support to SphinxSE</p></li>
  13014. <li class="listitem"><p>MAJOR CHANGE, our IANA assigned ports are 9312 and 9306 respectively (goodbye, trusty 3312)</p></li>
  13015. <li class="listitem"><p>MAJOR CHANGE, erroneous filters now fail with an error (were silently ignored before)</p></li>
  13016. <li class="listitem"><p>optimized unbuffered .spa writes on merge</p></li>
  13017. <li class="listitem"><p>optimized 1-keyword queries ranking in extended2 mode</p></li>
  13018. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=441" target="_top">#441</a> (IO race in case of highly conccurent load on a preopened)</p></li>
  13019. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=434" target="_top">#434</a> (distrubuted indexes were not searchable via MySQL protocol)</p></li>
  13020. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=317" target="_top">#317</a> (indexer MVA progress counter)</p></li>
  13021. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=398" target="_top">#398</a> (stopwords not removed from search query)</p></li>
  13022. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=328" target="_top">#328</a> (broken cutoff)</p></li>
  13023. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=250" target="_top">#250</a> (now quoting paths w/spaces when installing Windows service)</p></li>
  13024. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=348" target="_top">#348</a> (K-list was not updated on merge)</p></li>
  13025. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=357" target="_top">#357</a> (destination index were not K-list-filtered on merge)</p></li>
  13026. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=369" target="_top">#369</a> (precaching .spi files over 2 GBs)</p></li>
  13027. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=438" target="_top">#438</a> (missing boundary proximity matches)</p></li>
  13028. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=371" target="_top">#371</a> (.spa flush in case of files over 2 GBs)</p></li>
  13029. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=373" target="_top">#373</a> (crashes on distributed queries via mysql proto)</p></li>
  13030. <li class="listitem"><p>fixed critical bugs in hit merging code</p></li>
  13031. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=424" target="_top">#424</a> (ordinals could be misplaced during indexing in case of bitfields etc)</p></li>
  13032. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=426" target="_top">#426</a> (failing SE build on Solaris; thanks to Ben Beecher)</p></li>
  13033. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=423" target="_top">#423</a> (typo in SE caused crash on SHOW STATUS)</p></li>
  13034. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=363" target="_top">#363</a> (handling of read_timeout over 2147 seconds)</p></li>
  13035. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=376" target="_top">#376</a> (minor error message mismatch)</p></li>
  13036. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=413" target="_top">#413</a> (minus in SphinxQL)</p></li>
  13037. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=417" target="_top">#417</a> (floats w/o leading digit in SphinxQL)</p></li>
  13038. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=403" target="_top">#403</a> (typo in SetFieldWeights name in Java API)</p></li>
  13039. <li class="listitem"><p>fixed index rotation vs persistent connections</p></li>
  13040. <li class="listitem"><p>fixed backslash handling in SphinxQL parser</p></li>
  13041. <li class="listitem"><p>fixed uint unpacking vs. PHP 5.2.9 (possibly other versions)</p></li>
  13042. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=325" target="_top">#325</a> (filter settings send from SphinxSE)</p></li>
  13043. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=352" target="_top">#352</a> (removed mysql wrapper around close() in SphinxSE)</p></li>
  13044. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=389" target="_top">#389</a> (display error messages through SphinxSE status variable)</p></li>
  13045. <li class="listitem"><p>fixed linking with port-installed iconv on OS X</p></li>
  13046. <li class="listitem"><p>fixed negative 64-bit unpacking in PHP API</p></li>
  13047. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=349" target="_top">#349</a> (escaping backslash in query emulation mode)</p></li>
  13048. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=320" target="_top">#320</a> (disabled multi-query route when select items differ)</p></li>
  13049. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=353" target="_top">#353</a> (better quorum counts check)</p></li>
  13050. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=341" target="_top">#341</a> (merging of trailing hits; maybe other ranking issues too)</p></li>
  13051. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=368" target="_top">#368</a> (partially; @field "" caused crashes; now resets field limit)</p></li>
  13052. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=365" target="_top">#365</a> (field mask was leaking on field-limited terms)</p></li>
  13053. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=339" target="_top">#339</a> (updated debug query dumper)</p></li>
  13054. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=361" target="_top">#361</a> (added SetConnectTimeout() to Java API)</p></li>
  13055. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=338" target="_top">#338</a> (added missing fullscan to mode check in Java API)</p></li>
  13056. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=323" target="_top">#323</a> (added floats support to SphinxQL)</p></li>
  13057. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=340" target="_top">#340</a> (support listen=port:proto syntax too)</p></li>
  13058. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=332" target="_top">#332</a> (\r is legal SphinxQL space now)</p></li>
  13059. <li class="listitem"><p>fixed xmlpipe2 K-lists</p></li>
  13060. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=322" target="_top">#322</a> (safety gaps in mysql protocol row buffer)</p></li>
  13061. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=313" target="_top">#313</a> (return keyword stats for empty indexes too)</p></li>
  13062. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=344" target="_top">#344</a> (invalid checkpoints after merge)</p></li>
  13063. <li class="listitem"><p>fixed <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=326" target="_top">#326</a> (missing CLOCK_xxx on FreeBSD)</p></li>
  13064. </ul></div></div>
  13065. <div class="sect1" title="A.29.&nbsp;Version 0.9.9-rc2, 08 apr 2009"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel099rc2"></a>A.29.&nbsp;Version 0.9.9-rc2, 08 apr 2009</h2></div></div></div>
  13066. <div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added IsConnectError(), Open(), Close() calls to Java API (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=240" target="_top">#240</a>)</p></li>
  13067. <li class="listitem"><p>added <a class="link" href="#conf-read-buffer" title="12.4.18.&nbsp;read_buffer">read_buffer</a>, <a class="link" href="#conf-read-unhinted" title="12.4.19.&nbsp;read_unhinted">read_unhinted</a> directives</p></li>
  13068. <li class="listitem"><p>added checks for build options returned by mysql_config (builds on Solaris now)</p></li>
  13069. <li class="listitem"><p>added fixed-RAM index merge (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=169" target="_top">#169</a>)</p></li>
  13070. <li class="listitem"><p>added logging chained queries count in case of (optimized) multi-queries</p></li>
  13071. <li class="listitem"><p>added <a class="link" href="#sort-expr" title="5.6.&nbsp;SPH_SORT_EXPR mode">GEODIST()</a> function</p></li>
  13072. <li class="listitem"><p>added <a class="link" href="#ref-searchd" title="7.2.&nbsp;searchd command reference">--status switch to searchd</a></p></li>
  13073. <li class="listitem"><p>added MySpell (OpenOffice) affix file support (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=281" target="_top">#281</a>)</p></li>
  13074. <li class="listitem"><p>added <a class="link" href="#conf-odbc-dsn" title="12.1.10.&nbsp;odbc_dsn">ODBC support</a> (both Windows and UnixODBC)</p></li>
  13075. <li class="listitem"><p>added support for @id in IN() (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=292" target="_top">#292</a>)</p></li>
  13076. <li class="listitem"><p>added support for <a class="link" href="#api-func-setselect" title="9.2.4.&nbsp;SetSelect">aggregate functions</a> in GROUP BY (namely AVG, MAX, MIN, SUM)</p></li>
  13077. <li class="listitem"><p>added <a class="link" href="#sphinxse-snippets" title="10.4.&nbsp;Building snippets (excerpts) via MySQL">MySQL UDF that builds snippets</a> using searchd</p></li>
  13078. <li class="listitem"><p>added <a class="link" href="#conf-write-buffer" title="12.3.5.&nbsp;write_buffer">write_buffer</a> directive (defaults to 1M)</p></li>
  13079. <li class="listitem"><p>added <a class="link" href="#conf-xmlpipe-fixup-utf8" title="12.1.43.&nbsp;xmlpipe_fixup_utf8">xmlpipe_fixup_utf8</a> directive</p></li>
  13080. <li class="listitem"><p>added suggestions sample</p></li>
  13081. <li class="listitem"><p>added microsecond precision int64 timer (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=282" target="_top">#282</a>)</p></li>
  13082. <li class="listitem"><p>added <a class="link" href="#conf-listen-backlog" title="12.4.17.&nbsp;listen_backlog">listen_backlog directive</a></p></li>
  13083. <li class="listitem"><p>added <a class="link" href="#conf-max-xmlpipe2-field" title="12.3.4.&nbsp;max_xmlpipe2_field">max_xmlpipe2_field</a> directive</p></li>
  13084. <li class="listitem"><p>added <a class="link" href="#sphinxql" title="5.10.&nbsp;MySQL protocol support and SphinxQL">initial SphinxQL support</a> to mysql41 handler, SELECT .../SHOW WARNINGS/STATUS/META are handled</p></li>
  13085. <li class="listitem"><p>added support for different network protocols, and mysql41 protocol</p></li>
  13086. <li class="listitem"><p>added <a class="link" href="#api-func-setrankingmode" title="9.3.2.&nbsp;SetRankingMode">fieldmask ranker</a>, updated SphinxSE list of rankers</p></li>
  13087. <li class="listitem"><p>added <a class="link" href="#conf-mysql-ssl" title="12.1.9.&nbsp;mysql_ssl_cert, mysql_ssl_key, mysql_ssl_ca">mysql_ssl_xxx</a> directives</p></li>
  13088. <li class="listitem"><p>added <a class="link" href="#ref-searchd" title="7.2.&nbsp;searchd command reference">--cpustats (requires clock_gettime()) and --status switches</a> to searchd</p></li>
  13089. <li class="listitem"><p>added performance counters, <a class="link" href="#api-func-status" title="9.7.5.&nbsp;Status">Status()</a> API call</p></li>
  13090. <li class="listitem"><p>added <a class="link" href="#conf-overshort-step" title="12.2.43.&nbsp;overshort_step">overshort_step</a> and <a class="link" href="#conf-stopword-step" title="12.2.44.&nbsp;stopword_step">stopword_step</a> directives</p></li>
  13091. <li class="listitem"><p>added <a class="link" href="#extended-syntax" title="5.3.&nbsp;Extended query syntax">strict order operator</a> (aka operator before, eg. "one &lt;&lt; two &lt;&lt; three")</p></li>
  13092. <li class="listitem"><p>added <a class="link" href="#ref-indextool" title="7.4.&nbsp;indextool command reference">indextool</a> utility, moved --dumpheader there, added --debugdocids, --dumphitlist options</p></li>
  13093. <li class="listitem"><p>added own RNG, reseeded on @random sort query (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=183" target="_top">#183</a>)</p></li>
  13094. <li class="listitem"><p>added <a class="link" href="#extended-syntax" title="5.3.&nbsp;Extended query syntax">field-start and field-end modifiers support</a> (syntax is "^hello world$"; field-end requires reindex)</p></li>
  13095. <li class="listitem"><p>added MVA attribute support to IN() function</p></li>
  13096. <li class="listitem"><p>added <a class="link" href="#sort-expr" title="5.6.&nbsp;SPH_SORT_EXPR mode">AND, OR, and NOT support</a> to expressions</p></li>
  13097. <li class="listitem"><p>improved logging of (optimized) multi-queries (now logging chained query count)</p></li>
  13098. <li class="listitem"><p>improved handshake error handling, fixed protocol version byte order (omg)</p></li>
  13099. <li class="listitem"><p>updated SphinxSE to protocol 1.22</p></li>
  13100. <li class="listitem"><p>allowed phrase_boundary_step=-1 (trick to emulate keyword expansion)</p></li>
  13101. <li class="listitem"><p>removed SPH_MAX_QUERY_WORDS limit</p></li>
  13102. <li class="listitem"><p>fixed CLI search vs documents missing from DB (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=257" target="_top">#257</a>)</p></li>
  13103. <li class="listitem"><p>fixed libsphinxclient results leak on subsequent sphinx_run_queries call (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=256" target="_top">#256</a>)</p></li>
  13104. <li class="listitem"><p>fixed libsphinxclient handling of zero max_matches and cutoff (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=208" target="_top">#208</a>)</p></li>
  13105. <li class="listitem"><p>fixed Java API over-64K string reads (eg. big snippets) in Java API (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=181" target="_top">#181</a>)</p></li>
  13106. <li class="listitem"><p>fixed Java API 2nd Query() after network error in 1st Query() call (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=308" target="_top">#308</a>)</p></li>
  13107. <li class="listitem"><p>fixed typo-class bugs in SetFilterFloatRange (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=259" target="_top">#259</a>), SetSortMode (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=248" target="_top">#248</a>)</p></li>
  13108. <li class="listitem"><p>fixed missing @@relaxed support (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=276" target="_top">#276</a>), fixed missing error on @nosuchfield queries, documented @@relaxed</p></li>
  13109. <li class="listitem"><p>fixed UNIX socket permissions to 0777 (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=288" target="_top">#288</a>)</p></li>
  13110. <li class="listitem"><p>fixed xmlpipe2 crash on schemas with no fields, added better document structure checks</p></li>
  13111. <li class="listitem"><p>fixed (and optimized) expr parser vs IN() with huge (10K+) args count</p></li>
  13112. <li class="listitem"><p>fixed double EarlyCalc() in fullscan mode (minor performance impact)</p></li>
  13113. <li class="listitem"><p>fixed phrase boundary handling in some cases (on buffer end, on trailing whitespace)</p></li>
  13114. <li class="listitem"><p>fixes in snippets (aka excerpts) generation</p></li>
  13115. <li class="listitem"><p>fixed inline attrs vs id64 index corruption</p></li>
  13116. <li class="listitem"><p>fixed head searchd crash on config re-parse failure</p></li>
  13117. <li class="listitem"><p>fixed handling of numeric keywords with leading zeroes such as "007" (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=251" target="_top">#251</a>)</p></li>
  13118. <li class="listitem"><p>fixed junk in SphinxSE status variables (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=304" target="_top">#304</a>)</p></li>
  13119. <li class="listitem"><p>fixed wordlist checkpoints serialization (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=236" target="_top">#236</a>)</p></li>
  13120. <li class="listitem"><p>fixed unaligned docinfo id access (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=230" target="_top">#230</a>)</p></li>
  13121. <li class="listitem"><p>fixed GetRawBytes() vs oversized blocks (headers with over 32K charset_table should now work, bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=300" target="_top">#300</a>)</p></li>
  13122. <li class="listitem"><p>fixed buffer overflow caused by too long dest wordform, updated tests</p></li>
  13123. <li class="listitem"><p>fixed IF() return type (was always int, is deduced now)</p></li>
  13124. <li class="listitem"><p>fixed legacy queries vs. special chars vs. multiple indexes</p></li>
  13125. <li class="listitem"><p>fixed write-write-read socket access pattern vs Nagle vs delays vs FreeBSD (oh wow)</p></li>
  13126. <li class="listitem"><p>fixed exceptions vs query-parser issue</p></li>
  13127. <li class="listitem"><p>fixed late calc vs @weight in expressions (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=285" target="_top">#285</a>)</p></li>
  13128. <li class="listitem"><p>fixed early lookup/calc vs filters (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=284" target="_top">#284</a>)</p></li>
  13129. <li class="listitem"><p>fixed emulated MATCH_ANY queries (empty proximity and phrase queries are allowed now)</p></li>
  13130. <li class="listitem"><p>fixed MATCH_ANY ranker vs fields with no matches</p></li>
  13131. <li class="listitem"><p>fixed index file size vs inplace_enable (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=245" target="_top">#245</a>)</p></li>
  13132. <li class="listitem"><p>fixed that old logs were not closed on USR1 (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=221" target="_top">#221</a>)</p></li>
  13133. <li class="listitem"><p>fixed handling of '!' alias to NOT operator (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=237" target="_top">#237</a>)</p></li>
  13134. <li class="listitem"><p>fixed error handling vs query steps (step failure was not reported)</p></li>
  13135. <li class="listitem"><p>fixed querying vs inline attributes</p></li>
  13136. <li class="listitem"><p>fixed stupid bug in escaping code, fixed EscapeString() and made it static</p></li>
  13137. <li class="listitem"><p>fixed parser vs @field -keyword, foo|@field bar, "" queries (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=310" target="_top">#310</a>)</p></li>
  13138. </ul></div></div>
  13139. <div class="sect1" title="A.30.&nbsp;Version 0.9.9-rc1, 17 nov 2008"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel099rc1"></a>A.30.&nbsp;Version 0.9.9-rc1, 17 nov 2008</h2></div></div></div>
  13140. <div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added <a class="link" href="#conf-min-stemming-len" title="12.2.10.&nbsp;min_stemming_len">min_stemming_len</a> directive</p></li>
  13141. <li class="listitem"><p>added <a class="link" href="#api-func-isconnecterror" title="9.1.7.&nbsp;IsConnectError">IsConnectError()</a> API call (helps distingusih API vs remote errors)</p></li>
  13142. <li class="listitem"><p>added duplicate log messages filter to searchd</p></li>
  13143. <li class="listitem"><p>added --nodetach debugging switch to searchd</p></li>
  13144. <li class="listitem"><p>added blackhole agents support for debugging/testing (<a class="link" href="#conf-agent-blackhole" title="12.2.33.&nbsp;agent_blackhole">agent_blackhole</a> directive)</p></li>
  13145. <li class="listitem"><p>added <a class="link" href="#conf-max-filters" title="12.4.15.&nbsp;max_filters">max_filters</a>, <a class="link" href="#conf-max-filter-values" title="12.4.16.&nbsp;max_filter_values">max_filter_values</a> directives (were hardcoded before)</p></li>
  13146. <li class="listitem"><p>added int64 expression evaluation path, automatic inference, and BIGINT() enforcer function</p></li>
  13147. <li class="listitem"><p>added crash handler for debugging (<code class="option">crash_log_path</code> directive)</p></li>
  13148. <li class="listitem"><p>added MS SQL (aka SQL Server) source support (Windows only, <a class="link" href="#conf-mssql-winauth" title="12.1.44.&nbsp;mssql_winauth">mssql_winauth</a> and mssql_unicode directives)</p></li>
  13149. <li class="listitem"><p>added indexer-side column unpacking feature (<a class="link" href="#conf-unpack-zlib" title="12.1.45.&nbsp;unpack_zlib">unpack_zlib</a>, <a class="link" href="#conf-unpack-mysqlcompress" title="12.1.46.&nbsp;unpack_mysqlcompress">unpack_mysqlcompress</a> directives)</p></li>
  13150. <li class="listitem"><p>added nested brackers and NOTs support to <a class="link" href="#extended-syntax" title="5.3.&nbsp;Extended query syntax">query language</a>, rewritten query parser</p></li>
  13151. <li class="listitem"><p>added persistent connections support (<a class="link" href="#api-func-open" title="9.8.1.&nbsp;Open">Open()</a> and <a class="link" href="#api-func-close" title="9.8.2.&nbsp;Close">Close()</a> API calls)</p></li>
  13152. <li class="listitem"><p>added <a class="link" href="#conf-index-exact-words" title="12.2.42.&nbsp;index_exact_words">index_exact_words</a> feature, and exact form operator to query language ("hello =world")</p></li>
  13153. <li class="listitem"><p>added status variables support to SphinxSE (SHOW STATUS LIKE 'sphinx_%')</p></li>
  13154. <li class="listitem"><p>added <a class="link" href="#conf-max-packet-size" title="12.4.13.&nbsp;max_packet_size">max_packet_size</a> directive (was hardcoded at 8M before)</p></li>
  13155. <li class="listitem"><p>added UNIX socket support, and multi-interface support (<a class="link" href="#conf-listen" title="12.4.1.&nbsp;listen">listen</a> directive)</p></li>
  13156. <li class="listitem"><p>added star-syntax support to <a class="link" href="#api-func-buildexcerpts" title="9.7.1.&nbsp;BuildExcerpts">BuildExcerpts()</a> API call</p></li>
  13157. <li class="listitem"><p>added inplace inversion of .spa and .spp (<a class="link" href="#conf-inplace-enable" title="12.2.37.&nbsp;inplace_enable">inplace_enable</a> directive, 1.5-2x less disk space for indexing)</p></li>
  13158. <li class="listitem"><p>added builtin Czech stemmer (morphology=stem_cz)</p></li>
  13159. <li class="listitem"><p>added <a class="link" href="#sort-expr" title="5.6.&nbsp;SPH_SORT_EXPR mode">IDIV(), NOW(), INTERVAL(), IN() functions</a> to expressions</p></li>
  13160. <li class="listitem"><p>added index-level early-reject based on filters</p></li>
  13161. <li class="listitem"><p>added MVA updates feature (<a class="link" href="#conf-mva-updates-pool" title="12.4.14.&nbsp;mva_updates_pool">mva_updates_pool</a> directive)</p></li>
  13162. <li class="listitem"><p>added select-list feature with computed expressions support (see <a class="link" href="#api-func-setselect" title="9.2.4.&nbsp;SetSelect">SetSelect()</a> API call, test.php --select switch), protocol 1.22</p></li>
  13163. <li class="listitem"><p>added integer expressions support (2x faster than float)</p></li>
  13164. <li class="listitem"><p>added multiforms support (multiple source words in wordforms file)</p></li>
  13165. <li class="listitem"><p>added <a class="link" href="#api-func-setrankingmode" title="9.3.2.&nbsp;SetRankingMode">legacy rankers</a> (MATCH_ALL/MATCH_ANY/etc), removed legacy matching code (everything runs on V2 engine now)</p></li>
  13166. <li class="listitem"><p>added <a class="link" href="#extended-syntax" title="5.3.&nbsp;Extended query syntax">field position limit</a> modifier to field operator (syntax: @title[50] hello world)</p></li>
  13167. <li class="listitem"><p>added killlist support (<a class="link" href="#conf-sql-query-killlist" title="12.1.16.&nbsp;sql_query_killlist">sql_query_killlist</a> directive, --merge-killlists switch)</p></li>
  13168. <li class="listitem"><p>added on-disk SPI support (ondisk_dict directive)</p></li>
  13169. <li class="listitem"><p>added indexer IO stats</p></li>
  13170. <li class="listitem"><p>added periodic .spa flush (<a class="link" href="#conf-attr-flush-period" title="12.4.12.&nbsp;attr_flush_period">attr_flush_period</a> directive)</p></li>
  13171. <li class="listitem"><p>added config reload on SIGHUP</p></li>
  13172. <li class="listitem"><p>added per-query attribute overrides feature (see <a class="link" href="#api-func-setoverride" title="9.2.3.&nbsp;SetOverride">SetOverride()</a> API call); protocol 1.21</p></li>
  13173. <li class="listitem"><p>added signed 64bit attrs support (<a class="link" href="#conf-sql-attr-bigint" title="12.1.19.&nbsp;sql_attr_bigint">sql_attr_bigint</a> directive)</p></li>
  13174. <li class="listitem"><p>improved HTML stripper to also skip PIs (&lt;? ... ?&gt;, such as &lt;?php ... ?&gt;)</p></li>
  13175. <li class="listitem"><p>improved excerpts speed (upto 50x faster on big documents)</p></li>
  13176. <li class="listitem"><p>fixed a short window of searchd inaccessibility on startup (started listen()ing too early before)</p></li>
  13177. <li class="listitem"><p>fixed .spa loading on systems where read() is 2GB capped</p></li>
  13178. <li class="listitem"><p>fixed infixes vs morphology issues</p></li>
  13179. <li class="listitem"><p>fixed backslash escaping, added backslash to EscapeString()</p></li>
  13180. <li class="listitem"><p>fixed handling of over-2GB dictionary files (.spi)</p></li>
  13181. </ul></div></div>
  13182. <div class="sect1" title="A.31.&nbsp;Version 0.9.8.1, 30 oct 2008"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel0981"></a>A.31.&nbsp;Version 0.9.8.1, 30 oct 2008</h2></div></div></div>
  13183. <div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added configure script to libsphinxclient</p></li>
  13184. <li class="listitem"><p>changed proximity/quorum operator syntax to require whitespace after length</p></li>
  13185. <li class="listitem"><p>fixed potential head process crash on SIGPIPE during "maxed out" message</p></li>
  13186. <li class="listitem"><p>fixed handling of incomplete remote replies (caused over-degraded distributed results, in rare cases)</p></li>
  13187. <li class="listitem"><p>fixed sending of big remote requests (caused distributed requests to fail, in rare cases)</p></li>
  13188. <li class="listitem"><p>fixed FD_SET() overflow (caused searchd to crash on startup, in rare cases)</p></li>
  13189. <li class="listitem"><p>fixed MVA vs distributed indexes (caused loss of 1st MVA value in result set)</p></li>
  13190. <li class="listitem"><p>fixed tokenizing of exceptions terminated by specials (eg. "GPS AT&amp;T" in extended mode)</p></li>
  13191. <li class="listitem"><p>fixed buffer overrun in stemmer on overlong tokens occasionally emitted by proximity/quorum operator parser (caused crashes on certain proximity/quorum queries)</p></li>
  13192. <li class="listitem"><p>fixed wordcount ranker (could be dropping hits)</p></li>
  13193. <li class="listitem"><p>fixed --merge feature (numerous different fixes, caused broken indexes)</p></li>
  13194. <li class="listitem"><p>fixed --merge-dst-range performance</p></li>
  13195. <li class="listitem"><p>fixed prefix/infix generation for stopwords</p></li>
  13196. <li class="listitem"><p>fixed ignore_chars vs specials</p></li>
  13197. <li class="listitem"><p>fixed misplaced F_SETLKW check (caused certain build types, eg. RPM build on FC8, to fail)</p></li>
  13198. <li class="listitem"><p>fixed dictionary-defined charsets support in spelldump, added \x-style wordchars support</p></li>
  13199. <li class="listitem"><p>fixed Java API to properly send long strings (over 64K; eg. long document bodies for excerpts)</p></li>
  13200. <li class="listitem"><p>fixed Python API to accept offset/limit of 'long' type</p></li>
  13201. <li class="listitem"><p>fixed default ID range (that filtered out all 64-bit values) in Java and Python APIs</p></li>
  13202. </ul></div></div>
  13203. <div class="sect1" title="A.32.&nbsp;Version 0.9.8, 14 jul 2008"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel098"></a>A.32.&nbsp;Version 0.9.8, 14 jul 2008</h2></div></div></div>
  13204. <h3><a name="idp35767200"></a>Indexing</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added support for 64-bit document and keyword IDs, --enable-id64 switch to configure</p></li>
  13205. <li class="listitem"><p>added support for floating point attributes</p></li>
  13206. <li class="listitem"><p>added support for bitfields in attributes, <a class="link" href="#conf-sql-attr-bool" title="12.1.18.&nbsp;sql_attr_bool">sql_attr_bool</a> directive and bit-widths part in <a class="link" href="#conf-sql-attr-uint" title="12.1.17.&nbsp;sql_attr_uint">sql_attr_uint</a> directive</p></li>
  13207. <li class="listitem"><p>added support for multi-valued attributes (MVA)</p></li>
  13208. <li class="listitem"><p>added metaphone preprocessor</p></li>
  13209. <li class="listitem"><p>added libstemmer library support, provides stemmers for a number of additional languages</p></li>
  13210. <li class="listitem"><p>added xmlpipe2 source type, that supports arbitrary fields and attributes</p></li>
  13211. <li class="listitem"><p>added word form dictionaries, <a class="link" href="#conf-wordforms" title="12.2.12.&nbsp;wordforms">wordforms</a> directive (and spelldump utility)</p></li>
  13212. <li class="listitem"><p>added tokenizing exceptions, <a class="link" href="#conf-exceptions" title="12.2.14.&nbsp;exceptions">exceptions</a> directive</p></li>
  13213. <li class="listitem"><p>added an option to fully remove element contents to HTML stripper, <a class="link" href="#conf-html-remove-elements" title="12.2.29.&nbsp;html_remove_elements">html_remove_elements</a> directive</p></li>
  13214. <li class="listitem"><p>added HTML entities decoder (with full XHTML1 set support) to HTML stripper</p></li>
  13215. <li class="listitem"><p>added per-index HTML stripping settings, <a class="link" href="#conf-html-strip" title="12.2.27.&nbsp;html_strip">html_strip</a>, <a class="link" href="#conf-html-index-attrs" title="12.2.28.&nbsp;html_index_attrs">html_index_attrs</a>, and <a class="link" href="#conf-html-remove-elements" title="12.2.29.&nbsp;html_remove_elements">html_remove_elements</a> directives</p></li>
  13216. <li class="listitem"><p>added IO load throttling, <a class="link" href="#conf-max-iops" title="12.3.2.&nbsp;max_iops">max_iops</a> and <a class="link" href="#conf-max-iosize" title="12.3.3.&nbsp;max_iosize">max_iosize</a> directives</p></li>
  13217. <li class="listitem"><p>added SQL load throttling, <a class="link" href="#conf-sql-ranged-throttle" title="12.1.30.&nbsp;sql_ranged_throttle">sql_ranged_throttle</a> directive</p></li>
  13218. <li class="listitem"><p>added an option to index prefixes/infixes for given fields only, <a class="link" href="#conf-prefix-fields" title="12.2.21.&nbsp;prefix_fields">prefix_fields</a> and <a class="link" href="#conf-infix-fields" title="12.2.22.&nbsp;infix_fields">infix_fields</a> directives</p></li>
  13219. <li class="listitem"><p>added an option to ignore certain characters (instead of just treating them as whitespace), <a class="link" href="#conf-ignore-chars" title="12.2.17.&nbsp;ignore_chars">ignore_chars</a> directive</p></li>
  13220. <li class="listitem"><p>added an option to increment word position on phrase boundary characters, <a class="link" href="#conf-phrase-boundary" title="12.2.25.&nbsp;phrase_boundary">phrase_boundary</a> and <a class="link" href="#conf-phrase-boundary-step" title="12.2.26.&nbsp;phrase_boundary_step">phrase_boundary_step</a> directives</p></li>
  13221. <li class="listitem"><p>added --merge-dst-range switch (and filters) to index merging feature (--merge switch)</p></li>
  13222. <li class="listitem"><p>added <a class="link" href="#conf-mysql-connect-flags" title="12.1.8.&nbsp;mysql_connect_flags">mysql_connect_flags</a> directive (eg. to reduce indexing time MySQL network traffic and/or time)</p></li>
  13223. <li class="listitem"><p>improved ordinals sorting; now runs in fixed RAM</p></li>
  13224. <li class="listitem"><p>improved handling of documents with zero/NULL ids, now skipping them instead of aborting</p></li>
  13225. </ul></div>
  13226. <h3><a name="idp35795408"></a>Search daemon</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added an option to unlink old index on succesful rotation, <a class="link" href="#conf-unlink-old" title="12.4.11.&nbsp;unlink_old">unlink_old</a> directive</p></li>
  13227. <li class="listitem"><p>added an option to keep index files open at all times (fixes subtle races on rotation), <a class="link" href="#conf-preopen" title="12.2.36.&nbsp;preopen">preopen</a> and <a class="link" href="#conf-preopen-indexes" title="12.4.10.&nbsp;preopen_indexes">preopen_indexes</a> directives</p></li>
  13228. <li class="listitem"><p>added an option to profile searchd disk I/O, --iostats command-line option</p></li>
  13229. <li class="listitem"><p>added an option to rotate index seamlessly (fully avoids query stalls), <a class="link" href="#conf-seamless-rotate" title="12.4.9.&nbsp;seamless_rotate">seamless_rotate</a> directive</p></li>
  13230. <li class="listitem"><p>added HTML stripping support to excerpts (uses per-index settings)</p></li>
  13231. <li class="listitem"><p>added 'exact_phrase', 'single_passage', 'use_boundaries', 'weight_order 'options to <a class="link" href="#api-func-buildexcerpts" title="9.7.1.&nbsp;BuildExcerpts">BuildExcerpts()</a> API call</p></li>
  13232. <li class="listitem"><p>added distributed attribute updates propagation</p></li>
  13233. <li class="listitem"><p>added distributed retries on master node side</p></li>
  13234. <li class="listitem"><p>added log reopen on SIGUSR1</p></li>
  13235. <li class="listitem"><p>added --stop switch (sends SIGTERM to running instance)</p></li>
  13236. <li class="listitem"><p>added Windows service mode, and --servicename switch</p></li>
  13237. <li class="listitem"><p>added Windows --rotate support</p></li>
  13238. <li class="listitem"><p>improved log timestamping, now with millisecond precision</p></li>
  13239. </ul></div>
  13240. <h3><a name="idp35808112"></a>Querying</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added extended engine V2 (faster, cleaner, better; SPH_MATCH_EXTENDED2 mode)</p></li>
  13241. <li class="listitem"><p>added ranking modes support (V2 engine only; <a class="link" href="#api-func-setrankingmode" title="9.3.2.&nbsp;SetRankingMode">SetRankingMode()</a> API call)</p></li>
  13242. <li class="listitem"><p>added quorum searching support to query language (V2 engine only; example: "any three of all these words"/3)</p></li>
  13243. <li class="listitem"><p>added query escaping support to query language, and <a class="link" href="#api-func-escapestring" title="9.7.4.&nbsp;EscapeString">EscapeString()</a> API call</p></li>
  13244. <li class="listitem"><p>added multi-field syntax support to query language (example: "@(field1,field2) something"), and @@relaxed field checks option</p></li>
  13245. <li class="listitem"><p>added optional star-syntax ('word*') support in keywords, enable_star directive (for prefix/infix indexes only)</p></li>
  13246. <li class="listitem"><p>added full-scan support (query must be fully empty; can perform block-reject optimization)</p></li>
  13247. <li class="listitem"><p>added COUNT(DISTINCT(attr)) calculation support, <a class="link" href="#api-func-setgroupdistinct" title="9.5.2.&nbsp;SetGroupDistinct">SetGroupDistinct()</a> API call</p></li>
  13248. <li class="listitem"><p>added group-by on MVA support, <a class="link" href="#api-func-setarrayresult" title="9.1.6.&nbsp;SetArrayResult">SetArrayResult()</a> PHP API call</p></li>
  13249. <li class="listitem"><p>added per-index weights feature, <a class="link" href="#api-func-setindexweights" title="9.3.6.&nbsp;SetIndexWeights">SetIndexWeights()</a> API call</p></li>
  13250. <li class="listitem"><p>added geodistance support, <a class="link" href="#api-func-setgeoanchor" title="9.4.5.&nbsp;SetGeoAnchor">SetGeoAnchor()</a> API call</p></li>
  13251. <li class="listitem"><p>added result set sorting by arbitrary expressions in run time (eg. "@weight+log(price)*2.5"), SPH_SORT_EXPR mode</p></li>
  13252. <li class="listitem"><p>added result set sorting by @custom compile-time sorting function (see src/sphinxcustomsort.inl)</p></li>
  13253. <li class="listitem"><p>added result set sorting by @random value</p></li>
  13254. <li class="listitem"><p>added result set merging for indexes with different schemas</p></li>
  13255. <li class="listitem"><p>added query comments support (3rd arg to <a class="link" href="#api-func-query" title="9.6.1.&nbsp;Query">Query()</a>/<a class="link" href="#api-func-addquery" title="9.6.2.&nbsp;AddQuery">AddQuery()</a> API calls, copied verbatim to query log)</p></li>
  13256. <li class="listitem"><p>added keyword extraction support, <a class="link" href="#api-func-buildkeywords" title="9.7.3.&nbsp;BuildKeywords">BuildKeywords()</a> API call</p></li>
  13257. <li class="listitem"><p>added binding field weights by name, <a class="link" href="#api-func-setfieldweights" title="9.3.5.&nbsp;SetFieldWeights">SetFieldWeights()</a> API call</p></li>
  13258. <li class="listitem"><p>added optional limit on query time, <a class="link" href="#api-func-setmaxquerytime" title="9.2.2.&nbsp;SetMaxQueryTime">SetMaxQueryTime()</a> API call</p></li>
  13259. <li class="listitem"><p>added optional limit on found matches count (4rd arg to <a class="link" href="#api-func-setlimits" title="9.2.1.&nbsp;SetLimits">SetLimits()</a> API call, so-called 'cutoff')</p></li>
  13260. </ul></div>
  13261. <h3><a name="idp35830960"></a>APIs and SphinxSE</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added pure C API (libsphinxclient)</p></li>
  13262. <li class="listitem"><p>added Ruby API (thanks to Dmytro Shteflyuk)</p></li>
  13263. <li class="listitem"><p>added Java API</p></li>
  13264. <li class="listitem"><p>added SphinxSE support for MVAs (use varchar), floats (use float), 64bit docids (use bigint)</p></li>
  13265. <li class="listitem"><p>added SphinxSE options "floatrange", "geoanchor", "fieldweights", "indexweights", "maxquerytime", "comment", "host" and "port"; and support for "expr:CLAUSE"</p></li>
  13266. <li class="listitem"><p>improved SphinxSE max query size (using MySQL condition pushdown), upto 256K now</p></li>
  13267. </ul></div>
  13268. <h3><a name="idp35835360"></a>General</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added scripting (shebang syntax) support to config files (example: #!/usr/bin/php in the first line)</p></li>
  13269. <li class="listitem"><p>added unified config handling and validation to all programs</p></li>
  13270. <li class="listitem"><p>added unified documentation </p></li>
  13271. <li class="listitem"><p>added .spec file for RPM builds</p></li>
  13272. <li class="listitem"><p>added automated testing suite</p></li>
  13273. <li class="listitem"><p>improved index locking, now fcntl()-based instead of buggy file-existence-based</p></li>
  13274. <li class="listitem"><p>fixed unaligned RAM accesses, now works on SPARC and ARM</p></li>
  13275. </ul></div>
  13276. <h3><a name="rel098-fixes-since-rc2"></a>Changes and fixes since 0.9.8-rc2</h3><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added pure C API (libsphinxclient)</p></li>
  13277. <li class="listitem"><p>added Ruby API</p></li>
  13278. <li class="listitem"><p>added SetConnectTimeout() PHP API call</p></li>
  13279. <li class="listitem"><p>added allowed type check to UpdateAttributes() handler (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=174" target="_top">#174</a>)</p></li>
  13280. <li class="listitem"><p>added defensive MVA checks on index preload (protection against broken indexes, bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=168" target="_top">#168</a>)</p></li>
  13281. <li class="listitem"><p>added sphinx-min.conf sample file</p></li>
  13282. <li class="listitem"><p>added --without-iconv switch to configure</p></li>
  13283. <li class="listitem"><p>removed redundant -lz dependency in searchd</p></li>
  13284. <li class="listitem"><p>removed erroneous "xmlpipe2 deprecated" warning</p></li>
  13285. <li class="listitem"><p>fixed EINTR handling in piped read (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=166" target="_top">#166</a>)</p></li>
  13286. <li class="listitem"><p>fixup query time before logging and sending to client (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=153" target="_top">#153</a>)</p></li>
  13287. <li class="listitem"><p>fixed attribute updates vs full-scan early-reject index (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=149" target="_top">#149</a>)</p></li>
  13288. <li class="listitem"><p>fixed gcc warnings (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=160" target="_top">#160</a>)</p></li>
  13289. <li class="listitem"><p>fixed mysql connection attempt vs pgsql source type (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=165" target="_top">#165</a>)</p></li>
  13290. <li class="listitem"><p>fixed 32-bit wraparound when preloading over 2 GB files</p></li>
  13291. <li class="listitem"><p>fixed "out of memory" message vs over 2 GB allocs (bug <a class="ulink" href="http://sphinxsearch.com/bugs/view.php?id=116" target="_top">#116</a>)</p></li>
  13292. <li class="listitem"><p>fixed unaligned RAM access detection on ARM (where unaligned reads do not crash but produce wrong results)</p></li>
  13293. <li class="listitem"><p>fixed missing full scan results in some cases</p></li>
  13294. <li class="listitem"><p>fixed several bugs in --merge, --merge-dst-range</p></li>
  13295. <li class="listitem"><p>fixed @geodist vs MultiQuery and filters, @expr vs MultiQuery</p></li>
  13296. <li class="listitem"><p>fixed GetTokenEnd() vs 1-grams (was causing crash in excerpts)</p></li>
  13297. <li class="listitem"><p>fixed sql_query_range to handle empty strings in addition to NULL strings (Postgres specific)</p></li>
  13298. <li class="listitem"><p>fixed morphology=none vs infixes</p></li>
  13299. <li class="listitem"><p>fixed case sensitive attributes names in UpdateAttributes()</p></li>
  13300. <li class="listitem"><p>fixed ext2 ranking vs. stopwords (now using atompos from query parser)</p></li>
  13301. <li class="listitem"><p>fixed EscapeString() call</p></li>
  13302. <li class="listitem"><p>fixed escaped specials (now handled as whitespace if not in charset)</p></li>
  13303. <li class="listitem"><p>fixed schema minimizer (now handles type/size mismatches)</p></li>
  13304. <li class="listitem"><p>fixed word stats in extended2; stemmed form is now returned</p></li>
  13305. <li class="listitem"><p>fixed spelldump case folding vs dictionary-defined character sets</p></li>
  13306. <li class="listitem"><p>fixed Postgres BOOLEAN handling </p></li>
  13307. <li class="listitem"><p>fixed enforced "inline" docinfo on empty indexes (normally ok, but index merge was really confused)</p></li>
  13308. <li class="listitem"><p>fixed rare count(distinct) out-of-bounds issue (it occasionaly caused too high @distinct values)</p></li>
  13309. <li class="listitem"><p>fixed hangups on documents with id=DOCID_MAX in some cases</p></li>
  13310. <li class="listitem"><p>fixed rare crash in tokenizer (prefixed synonym vs. input stream eof)</p></li>
  13311. <li class="listitem"><p>fixed query parser vs "aaa (bbb ccc)|ddd" queries</p></li>
  13312. <li class="listitem"><p>fixed BuildExcerpts() request in Java API</p></li>
  13313. <li class="listitem"><p>fixed Postgres specific memory leak</p></li>
  13314. <li class="listitem"><p>fixed handling of overshort keywords (less than min_word_len)</p></li>
  13315. <li class="listitem"><p>fixed HTML stripper (now emits space after indexed attributes)</p></li>
  13316. <li class="listitem"><p>fixed 32-field case in query parser</p></li>
  13317. <li class="listitem"><p>fixed rare count(distinct) vs. querying multiple local indexes vs. reusable sorter issue</p></li>
  13318. <li class="listitem"><p>fixed sorting of negative floats in SPH_SORT_EXTENDED mode</p></li>
  13319. </ul></div></div>
  13320. <div class="sect1" title="A.33.&nbsp;Version 0.9.7, 02 apr 2007"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel097"></a>A.33.&nbsp;Version 0.9.7, 02 apr 2007</h2></div></div></div>
  13321. <div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added support for <code class="option">sql_str2ordinal_column</code></p></li>
  13322. <li class="listitem"><p>added support for upto 5 sort-by attrs (in extended sorting mode)</p></li>
  13323. <li class="listitem"><p>added support for separate groups sorting clause (in group-by mode)</p></li>
  13324. <li class="listitem"><p>added support for on-the-fly attribute updates (PRE-ALPHA; will change heavily; use for preliminary testing ONLY)</p></li>
  13325. <li class="listitem"><p>added support for zero/NULL attributes</p></li>
  13326. <li class="listitem"><p>added support for 0.9.7 features to SphinxSE</p></li>
  13327. <li class="listitem"><p>added support for n-grams (alpha, 1-grams only for now)</p></li>
  13328. <li class="listitem"><p>added support for warnings reported to client</p></li>
  13329. <li class="listitem"><p>added support for exclude-filters</p></li>
  13330. <li class="listitem"><p>added support for prefix and infix indexing (see <code class="option">max_prefix_len</code>, <code class="option">max_infix_len</code>)</p></li>
  13331. <li class="listitem"><p>added <code class="option">@*</code> syntax to reset current field to query language</p></li>
  13332. <li class="listitem"><p>added removal of duplicate entries in query index order</p></li>
  13333. <li class="listitem"><p>added PHP API workarounds for PHP signed/unsigned braindamage</p></li>
  13334. <li class="listitem"><p>added locks to avoid two concurrent indexers working on same index</p></li>
  13335. <li class="listitem"><p>added check for existing attributes vs. <code class="option">docinfo=none</code> case</p></li>
  13336. <li class="listitem"><p>improved groupby code a lot (better precision, and upto 25x times faster in extreme cases)</p></li>
  13337. <li class="listitem"><p>improved error handling and reporting</p></li>
  13338. <li class="listitem"><p>improved handling of broken indexes (reports error instead of hanging/crashing)</p></li>
  13339. <li class="listitem"><p>improved <code class="option">mmap()</code> limits for attributes and wordlists (now able to map over 4 GB on x64 and over 2 GB on x32 where possible)</p></li>
  13340. <li class="listitem"><p>improved <code class="option">malloc()</code> pressure in head daemon (search time should not degrade with time any more)</p></li>
  13341. <li class="listitem"><p>improved <code class="filename">test.php</code> command line options</p></li>
  13342. <li class="listitem"><p>improved error reporting (distributed query, broken index etc issues now reported to client)</p></li>
  13343. <li class="listitem"><p>changed default network packet size to be 8M, added extra checks</p></li>
  13344. <li class="listitem"><p>fixed division by zero in BM25 on 1-document collections (in extended matching mode)</p></li>
  13345. <li class="listitem"><p>fixed <code class="filename">.spl</code> files getting unlinked</p></li>
  13346. <li class="listitem"><p>fixed crash in schema compatibility test</p></li>
  13347. <li class="listitem"><p>fixed UTF-8 Russian stemmer</p></li>
  13348. <li class="listitem"><p>fixed requested matches count when querying distributed agents</p></li>
  13349. <li class="listitem"><p>fixed signed vs. unsigned issues everywhere (ranged queries, CLI search output, and obtaining docid)</p></li>
  13350. <li class="listitem"><p>fixed potential crashes vs. negative query offsets</p></li>
  13351. <li class="listitem"><p>fixed 0-match docs vs. extended mode vs. stats</p></li>
  13352. <li class="listitem"><p>fixed group/timestamp filters being ignored if querying from older clients</p></li>
  13353. <li class="listitem"><p>fixed docs to mention <code class="option">pgsql</code> source type</p></li>
  13354. <li class="listitem"><p>fixed issues with explicit '&amp;' in extended matching mode</p></li>
  13355. <li class="listitem"><p>fixed wrong assertion in SBCS encoder</p></li>
  13356. <li class="listitem"><p>fixed crashes with no-attribute indexes after rotate</p></li>
  13357. </ul></div></div>
  13358. <div class="sect1" title="A.34.&nbsp;Version 0.9.7-rc2, 15 dec 2006"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel097rc2"></a>A.34.&nbsp;Version 0.9.7-rc2, 15 dec 2006</h2></div></div></div>
  13359. <div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added support for extended matching mode (query language)</p></li>
  13360. <li class="listitem"><p>added support for extended sorting mode (sorting clauses)</p></li>
  13361. <li class="listitem"><p>added support for SBCS excerpts</p></li>
  13362. <li class="listitem"><p>added <code class="option">mmap()ing</code> for attributes and wordlist (improves search time, speeds up <code class="option">fork()</code> greatly)</p></li>
  13363. <li class="listitem"><p>fixed attribute name handling to be case insensitive</p></li>
  13364. <li class="listitem"><p>fixed default compiler options to simplify post-mortem debugging (added <code class="option">-g</code>, removed <code class="option">-fomit-frame-pointer</code>)</p></li>
  13365. <li class="listitem"><p>fixed rare memory leak</p></li>
  13366. <li class="listitem"><p>fixed "hello hello" queries in "match phrase" mode</p></li>
  13367. <li class="listitem"><p>fixed issue with excerpts, texts and overlong queries</p></li>
  13368. <li class="listitem"><p>fixed logging multiple index name (no longer tokenized)</p></li>
  13369. <li class="listitem"><p>fixed trailing stopword not flushed from tokenizer</p></li>
  13370. <li class="listitem"><p>fixed boolean evaluation</p></li>
  13371. <li class="listitem"><p>fixed pidfile being wrongly <code class="option">unlink()ed</code> on <code class="option">bind()</code> failure</p></li>
  13372. <li class="listitem"><p>fixed <code class="option">--with-mysql-includes/libs</code> (they conflicted with well-known paths)</p></li>
  13373. <li class="listitem"><p>fixes for 64-bit platforms</p></li>
  13374. </ul></div></div>
  13375. <div class="sect1" title="A.35.&nbsp;Version 0.9.7-rc1, 26 oct 2006"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel097rc"></a>A.35.&nbsp;Version 0.9.7-rc1, 26 oct 2006</h2></div></div></div>
  13376. <div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added alpha index merging code</p></li>
  13377. <li class="listitem"><p>added an option to decrease <code class="option">max_matches</code> per-query</p></li>
  13378. <li class="listitem"><p>added an option to specify IP address for searchd to listen on</p></li>
  13379. <li class="listitem"><p>added support for unlimited amount of configured sources and indexes</p></li>
  13380. <li class="listitem"><p>added support for group-by queries</p></li>
  13381. <li class="listitem"><p>added support for /2 range modifier in charset_table</p></li>
  13382. <li class="listitem"><p>added support for arbitrary amount of document attributes</p></li>
  13383. <li class="listitem"><p>added logging filter count and index name</p></li>
  13384. <li class="listitem"><p>added <code class="option">--with-debug</code> option to configure to compile in debug mode</p></li>
  13385. <li class="listitem"><p>added <code class="option">-DNDEBUG</code> when compiling in default mode</p></li>
  13386. <li class="listitem"><p>improved search time (added doclist size hints, in-memory wordlist cache, and used VLB coding everywhere)</p></li>
  13387. <li class="listitem"><p>improved (refactored) SQL driver code (adding new drivers should be very easy now)</p></li>
  13388. <li class="listitem"><p>improved exceprts generation</p></li>
  13389. <li class="listitem"><p>fixed issue with empty sources and ranged queries</p></li>
  13390. <li class="listitem"><p>fixed querying purely remote distributed indexes</p></li>
  13391. <li class="listitem"><p>fixed suffix length check in English stemmer in some cases</p></li>
  13392. <li class="listitem"><p>fixed UTF-8 decoder for codes over U+20000 (for CJK)</p></li>
  13393. <li class="listitem"><p>fixed UTF-8 encoder for 3-byte sequences (for CJK)</p></li>
  13394. <li class="listitem"><p>fixed overshort (less than <code class="option">min_word_len</code>) words prepended to next field</p></li>
  13395. <li class="listitem"><p>fixed source connection order (indexer does not connect to all sources at once now)</p></li>
  13396. <li class="listitem"><p>fixed line numbering in config parser</p></li>
  13397. <li class="listitem"><p>fixed some issues with index rotation</p></li>
  13398. </ul></div></div>
  13399. <div class="sect1" title="A.36.&nbsp;Version 0.9.6, 24 jul 2006"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel096"></a>A.36.&nbsp;Version 0.9.6, 24 jul 2006</h2></div></div></div>
  13400. <div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added support for empty indexes</p></li>
  13401. <li class="listitem"><p>added support for multiple sql_query_pre/post/post_index</p></li>
  13402. <li class="listitem"><p>fixed timestamp ranges filter in "match any" mode</p></li>
  13403. <li class="listitem"><p>fixed configure issues with --without-mysql and --with-pgsql options</p></li>
  13404. <li class="listitem"><p>fixed building on Solaris 9</p></li>
  13405. </ul></div></div>
  13406. <div class="sect1" title="A.37.&nbsp;Version 0.9.6-rc1, 26 jun 2006"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rel096rc1"></a>A.37.&nbsp;Version 0.9.6-rc1, 26 jun 2006</h2></div></div></div>
  13407. <div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>added boolean queries support (experimental, beta version)</p></li>
  13408. <li class="listitem"><p>added simple file-based query cache (experimental, beta version)</p></li>
  13409. <li class="listitem"><p>added storage engine for MySQL 5.0 and 5.1 (experimental, beta version)</p></li>
  13410. <li class="listitem"><p>added GNU style <code class="filename">configure</code> script</p></li>
  13411. <li class="listitem"><p>added new searchd protocol (all binary, and should be backwards compatible)</p></li>
  13412. <li class="listitem"><p>added distributed searching support to searchd</p></li>
  13413. <li class="listitem"><p>added PostgreSQL driver</p></li>
  13414. <li class="listitem"><p>added excerpts generation</p></li>
  13415. <li class="listitem"><p>added <code class="option">min_word_len</code> option to index</p></li>
  13416. <li class="listitem"><p>added <code class="option">max_matches</code> option to searchd, removed hardcoded MAX_MATCHES limit</p></li>
  13417. <li class="listitem"><p>added initial documentation, and a working <code class="filename">example.sql</code></p></li>
  13418. <li class="listitem"><p>added support for multiple sources per index</p></li>
  13419. <li class="listitem"><p>added soundex support</p></li>
  13420. <li class="listitem"><p>added group ID ranges support</p></li>
  13421. <li class="listitem"><p>added <code class="option">--stdin</code> command-line option to search utility</p></li>
  13422. <li class="listitem"><p>added <code class="option">--noprogress</code> option to indexer</p></li>
  13423. <li class="listitem"><p>added <code class="option">--index</code> option to search</p></li>
  13424. <li class="listitem"><p>fixed UTF-8 decoder (3-byte codepoints did not work)</p></li>
  13425. <li class="listitem"><p>fixed PHP API to handle big result sets faster</p></li>
  13426. <li class="listitem"><p>fixed config parser to handle empty values properly</p></li>
  13427. <li class="listitem"><p>fixed redundant <code class="code">time(NULL)</code> calls in time-segments mode</p></li>
  13428. </ul></div></div></div></div>
  13429. </body></html>