• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

docs/H03-May-2022-3,307534

examples/H03-May-2022-1,251735

pecl-compat/H03-May-2022-1,032653

src/php7/H03-May-2022-21,81513,312

tests/H03-May-2022-6,9045,708

CREDITSH A D09-Sep-202034 43

LICENSEH A D09-Sep-20203.1 KiB6955

README.ABOUT_SOLR_EXTENSIONH A D09-Sep-20206.1 KiB155122

README.CONTRIBUTORSH A D09-Sep-20203.2 KiB6350

README.INSTALLATIONH A D09-Sep-20207.4 KiB235133

README.MEMORY_ALLOCATIONH A D09-Sep-20202.7 KiB5541

README.SUBMITTING_CONTRIBUTIONSH A D09-Sep-20202.2 KiB5136

TODOH A D09-Sep-2020810 2413

config.m4H A D09-Sep-20205.4 KiB160132

config.w32H A D09-Sep-20204 KiB10696

solr.dspH A D09-Sep-20206.1 KiB224160

README.ABOUT_SOLR_EXTENSION

1================================================================================
2Introducing the Solr PHP Extension
3================================================================================
4The Solr extension is an extremely fast, light-weight, feature-rich library that
5allows PHP developers to communicate effectively with Solr server instances.
6
7There are tools to add documents and make updates to the solr server.
8
9It also contains tools that allows you to build advanced queries to the server
10when searching for documents.
11
12There are also special objects that simplifies the sending of name-value requests
13to the server. This includes the SolrParams class and all its child classes.
14
15The SolrClient object allows one to communicate with Solr containers that are
16behind proxy servers or that require HTTP Authentication to proceed.
17
18The SolrClient constructor accepts options such as
19http authentication username and passwor, proxy server name, port, login and
20passwords etc.
21
22Using an advanced http client like libcurl allows us to leverage the features
23available with the library. We can reuse the HTTP connections without having
24to create a separate one for each request.
25
26================================================================================
27How to Install
28================================================================================
29
30Please refer to the README.INSTALLATION file.
31
32================================================================================
33Magic Methods and Interfaces Implemented
34================================================================================
35
36SolrDocument implements the following interfaces.
37
38(1) ArrayAccess  - to access the fields as array keys using field names.
39(2) Iterator	 - to iterate over the document fields using foreach()
40(3) Serializable - provides custom serialization of the object.
41
42SolrDocument also contains the __get and __set magic methods which allows developers
43to access the fields directly. When setting fields, if the field already
44has a value the new value will be appended to the list of values for that field.
45
46Each field is a SolrDocumentField object with the following public properties :
47
48(a) name - a string with name of the field.
49(b) boost - a double representing the boost value of the field (intentionally empty)
50(c) values - an array of all the field values as strings.
51
52Custom Serialization
53
54string SolrDocument::serialize(void) returns an XML document representing a
55SolrDocument as shown below :
56
57<?xml version="1.0" encoding="UTF-8"?>
58<solr_document>
59  <fields>
60    <field name="id">
61      <field_value>A0F43D</field_value>
62    </field>
63    <field name="name">
64      <field_value>Israel Ekpo</field_value>
65    </field>
66    <field name="email">
67      <field_value>Israel.Ekpo@israel.ekpo.com</field_value>
68    </field>
69    <field name="skills">
70      <field_value>Reading</field_value>
71      <field_value>Writing</field_value>
72      <field_value>Soccer</field_value>
73      <field_value>Teaching</field_value>
74    </field>
75    <field name="languages">
76      <field_value>Inglés</field_value>
77      <field_value>Espanól</field_value>
78    </field>
79  </fields>
80</solr_document>
81
82Here is a complete example of a serialized SolrDocument object:
83
84C:12:"SolrDocument":679:{<?xml version="1.0" encoding="UTF-8"?>
85<solr_document>
86  <fields>
87    <field name="id">
88      <field_value>A0F43D</field_value>
89    </field>
90    <field name="name">
91      <field_value>Israel Ekpo</field_value>
92    </field>
93    <field name="email">
94      <field_value>Israel.Ekpo@israel.ekpo.com</field_value>
95    </field>
96    <field name="skills">
97      <field_value>Reading</field_value>
98      <field_value>Writing</field_value>
99      <field_value>Soccer</field_value>
100      <field_value>Teaching</field_value>
101    </field>
102    <field name="languages">
103      <field_value>Inglés</field_value>
104      <field_value>Espanól</field_value>
105    </field>
106  </fields>
107</solr_document>
108}
109
110One of the items on my todo list is to create a response writer to return
111serialized SolrDocument objects instead of document arrays.
112
113SolrDocument::unserialize(string $serialized) accepts an XML document
114representing the SolrDocument object. It will the bring the object back to live.
115
116The SolrDocument class also has the method SolrDocument::getInputDocument() to
117allow one do get the SolrInputDocument version of a SolrDocument instance.
118
119This method may be helpful if one needs to resubmit the document to the server to
120updates.
121
122The Solr extension has the SolrQuery object (a child of SolrParams) that enables
123the developer to send custom advanced name-value requests to the solr server.
124
125The SolrQuery object can also be serialized and reused later, which makes it very
126helpful to saving the state of the application across multiple requests. This may be
127very useful in cases such as facet browsing where additional parameters may need to be
128added to the current object or removed from it to get the desired results without
129having to start over from scratch.
130
131================================================================================
132Parsing of XML Responses from the Solr Server
133================================================================================
134XML responses from the solr server are expected to be formatted using version 2.2
135These xml documents are parsed into serialized php code and returned as
136read-only SolrObject instances whose properties can also be accessed as array
137keys in addition to being accessible directly via the object->member notation.
138
139Having the properties accessible via object[member] notation is helpful in cases
140where the property name is not valid (contains dots and other characters not
141legal in php.
142
143================================================================================
144How to Report Bugs
145================================================================================
146
147Please report bugs to http://bugs.php.net
148
149If you experience a crash due to a segmentation fault, please follow the instructions on the link below
150to get a gdb backtrace and then submit the trace in your bug report as well
151
152http://bugs.php.net/bugs-generating-backtrace.php
153
154Thank you for using PHP
155

README.CONTRIBUTORS

1================================================================================
2Omar Shaban (omars@php.net)
3================================================================================
4 - Lead Maintainer
5================================================================================
6
7Thanks to all our [contributors](https://github.com/php/pecl-search_engine-solr/graphs/contributors).
8
9================================================================================
10
11These are the people that made version 1.0 release of the Apache Solr PECL extension possible.
12
13If I have left anyone out or mis-stated your contributions, please let me know so that
14it can be correct to reflect your contributions accurately.
15
16Thanks again for making this possible.
17
18================================================================================
19Israel Ekpo (iekpo@php.net)
20================================================================================
21 - Orignal Author of the Apache Solr PECL extension
22 - Orignal Extension Concept and Design
23 - Lead Maintainer
24
25================================================================================
26Pierre-Alain Joye (pajoye@php.net)
27================================================================================
28 - Fine tuned and created the final version of the config.w32 script (291135)
29 - Compiled and made available several versions of the .dll binaries for Windows.
30 - Currently hosting the windows .dll binaries for the Apache Solr PECL extension.
31
32================================================================================
33Kalle Sommer Nielsen (kalle@php.net)
34================================================================================
35 - Significant refactoring of the config.w32 script for Windows (288890)
36 - Corrected Windows C++ compiler bugs (288890)
37
38================================================================================
39Pierrick Charron (pierrick@php.net)
40================================================================================
41 - Assisted in the testing of the extension using various test cases.
42 - Uncovered and reported several bugs due to his insight of the extension internals.
43 - Discovered bugs 16943 and 16924
44 - Patched the config.w32 for its first successful compilation on Windows (291101).
45
46================================================================================
47Felipe Pena (felipe@php.net)
48================================================================================
49 - Participated significantly after the intial release and uncovered a serious bug that lead to segfaults.
50 - Discovered bugs 16855 thru 16859
51 - Contributed to development of UNIX config.m4 script (289148)
52
53================================================================================
54Alex Samorukov (alexey.samorukov@varien.com)
55================================================================================
56 - Lowered minimum supported version for libcurl to 7.15.0
57 - Lowered minimum supported version for libxml2 to 2.6.26
58
59================================================================================
60(trevor at blubolt dot com, max at blubolt dot com)
61================================================================================
62 - Fixed PECL Bug# 17172 MoreLikeThis only parses one doc
63

README.INSTALLATION

1================================================================================
2PHP VERSION Dependencies
3================================================================================
4
5PHP version 5.3 or later is needed
6
7================================================================================
8Extension Dependencies
9================================================================================
10LIBXML extension
11JSON extension
12
13================================================================================
14Library Dependencies
15================================================================================
16
17libxml2 2.6.26 or later is required
18
19libcurl 7.15.0 or later is required
20
21================================================================================
22On UNIX
23================================================================================
24
25As mentioned before, the libxml and curl extensions must be enabled for the Apache Solr extension to be functional.
26
27Do not attempt to hack the code to make it compile. It will fail, possibly with errors that could be hard to debug
28
29To install the Apache Solr extension directly from PECL, please enter the following command, then follow the prompts
30
31pecl install solr
32
33To compile from source, please follow the following steps
34
35$ phpize
36
37$ ./configure
38
39$ make && make install
40
41This should compile the code and install it in the extension_dir specified in the ini file.
42
43Then open your php.ini file and add the following line to it
44
45extension=solr.so
46
47Then restart your webserver. For CLI only, you do not have to restart your webserver.
48
49Note :
50
51If your system does not have the minimum version of the libcurl or libxml libraries, you can download the libraries
52
53and compile them from source into a separate install prefix.
54
55wget http://curl.haxx.se/download/curl-7.19.6.tar.gz
56
57tar -zxvf curl-7.19.6.tar.gz
58
59cd curl-7.19.6
60
61configure --prefix=/root/custom/software
62
63make && make install
64
65cd ..
66
67wget ftp://xmlsoft.org/libxml2/libxml2-2.7.6.tar.gz
68
69tar -zxvf libxml2-2.7.6.tar.gz
70
71cd libxml2-2.7.6
72
73configure --prefix=/root/custom/software
74
75make && make install
76
77This example assumes that the libxml2 and libcurl libraries were compiled from source
78
79and installed using "/root/custom/software" as the --prefix
80
81So the absolute path to the easy.h header file will be
82
83/root/custom/software/include/curl/easy.h
84
85And the absolute path to the libxml/parser.h header file wil be
86
87/root/custom/software/include/libxml2/libxml/parser.h
88
89The absolute path to the xml2-config script will be /root/custom/software/bin/xml2-config
90
91And the absolute path to the curl-config script will be /root/custom/software/bin/curl-config
92
93Then you can pass libcurl prefix to the configure script for CURL and LIBXML respectively
94
95during the configuration phase as shown here :
96
974B ./configure --enable-solr --with-curl=/root/custom/software --with-libxml-dir=/root/custom/software
98
99If you already have the latest versions of the libraries then the step listed in 4A alone is sufficient.
100
1015. make && make install
102
103This should compile the code and install it in the extension_dir specified in the ini file.
104
105Then open your php.ini file and add the following line to it
106
107extension=solr.so
108
109If you would prefer to compile the Solr extension statically into php,
110
111you will need to follow the following steps.
112
1131. copy the solr_xxx folder into the ext folder in the php source
114
1152. Include the --enable-solr flag as one of the options when configuring php
116
117This will build the Solr extension statically into php.
118
119After the installation is completed, you will have to restart your webserver for the changes to take effect.
120
121For CLI only use, you do not have to restart your webserver.
122
123================================================================================
124On Windows
125================================================================================
126
127If you are using a pre-compiled dll, simply copy the php_solr.dll file
128to your extension_dir specified in the ini file.
129
130Then open your php.ini file and add the following line to it
131
132extension=php_solr.dll
133
134Then restart your webserver. For CLI only, you do not have to restart your webserver.
135
136If you are building from source, you will need to download the library dependencies
137for libxml and libcurl from the following link to the deps folder before
138running buildconf.bat
139
140http://wiki.php.net/internals/windows/libs
141
142http://pecl2.php.net/downloads/php-windows-builds/php-libs/
143
144More details are avialable here
145
146http://wiki.php.net/internals/windows
147
148Windows DLLs are now available here
149
150http://downloads.php.net/pierre/
151
152If you are building from source, you will need to download the library dependencies
153for libxml and libcurl from the following link to the deps folder before
154running buildconf.bat
155
156The Apache Solr extension can be compiled statically or shared.
157
158- Shared compilation creates a php_solr.dll file.
159- Static compilation puts the Solr extension directly into PHP (therefore it does not need to be loaded and cannot be unloaded).
160
161You can toggle between compiling statically or as library by adding =static or =shared to the configure.js command during the compilation.
162
163configure --with-solr=static
164
165configure --with-solr=shared
166
167- In the first configure command, the Apache Solr extension will be included in PHP
168- In the second configure command, the Apache Solr extension will be compiled as separate DLL
169
170Here is a more detail list of steps to follow :
171
1721. Get visual studio 2008 ((express edition or professional) and install it.
1732. Get and install windows sdk 6.1.
1743. Get a php 5.3 snapshot (do not extract yet!).
1754. Create the folder "c:\php-sdk"
1765. Unpack the binary tools archive into this directory, there should be one sub-directory called "bin" and one called "script"
1776. Open the "windows sdk 6.1 shell" (which is available from the start menu group) and execute the following commands in it:
178
179setenv /x86 /xp /release
180cd c:\php-sdk\
181bin\phpsdk_setvars.bat
182bin\phpsdk_buildtree.bat php53dev
183
1847. Now extract the snapshot from Step 3 to C:\php-sdk\php53dev\vc9\x86 with your favourite unpacker so that the following directory gets created:
185
186C:\php-sdk\php53dev\vc9\x86\php5.3-xyz
187
1888. run in the windows-sdk-shell:
189cd C:\php-sdk\php53dev\vc9\x86\php5.3-xyz
190buildconf
191
1929. now run configure --help, to get an overview of the compiling flags
193
19410. configure --disable-all --enable-cli --with-solr=yes --with-curl=yes --with-libxml=yes
195
19611. nmake
197
198If you are using Visual Studio 2005, use vc8 wherever you see vc9.
199
200If you are on a 64-bit system, use x64 instead of x86.
201
202The following resources can provide you with more information :
203
204http://wiki.php.net/internals/windows/libs
205
206http://pecl2.php.net/downloads/php-windows-builds/php-libs/
207
208More details are avialable here :
209
210http://wiki.php.net/internals/windows
211
212The binary tools archive is available at :
213
214http://pecl2.php.net/downloads/php-windows-builds/php-libs/binary-tools.zip
215
216Windows SDK 6.1 is available at :
217
218http://www.microsoft.com/downloads/details.aspx?FamilyId=E6E1C3DF-A74F-4207-8586-711EBE331CDC&displaylang=en
219
220The PHP 5.3 shapshot is available at:
221
222http://windows.php.net/downloads/snaps/php-5.3/php-5.3-src-latest.zip
223
224================================================================================
225How to Report Bugs
226================================================================================
227
228Please report bugs to omars@php.net
229
230You can also register bugs here
231
232http://pecl.php.net/bugs/report.php?package=solr
233
234Thank you for using PHP
235

README.MEMORY_ALLOCATION

1================================================================================
2Solr Notes about Memory Allocation and interaction with HashTables
3================================================================================
4
5The following notes are for C-space PHP developers.
6
7If you are not really familiar with how the Zend HashTable API or the
8memory allocation marcros really works, please take sometime to read the notes below :
9
10This is correct as of Zend Engine version 2.3.0
11
12- If memory was allocated with emalloc(), it has to be freed with efree().
13
14- If memory was allocated using pemalloc(), the same value for the persistent
15parameter must be used during pefree() to deallocated the allocated memory.
16The memory manager for the Zend API will then decide whether to use free() or
17efree() depending on whether persistent is 1 or 0 respectively. The same
18principle applies to pestrdup(), pecalloc() and the other memory allocation
19macros.
20
21- When inserting values into the HashTables, if the value for the persistent
22parameter is set, then the memory allocation for the entered item should be
23persistent to i.e. pemalloc() with persistent set to 1.
24
25The following will apply when adding new values into a HashTable for items
26that were dynamically allocated :
27
28(a) If the value for the nDataSize parameter is the size of that of a
29pointer sizeof(void *), the HashTable API copies the contents of
30the pData parameter into the Bucket->pDataPtr member for that data Bucket.
31Then it sets the Bucket->pData member to the address of the Bucket->pDataPtr
32member for that data Bucket.
33
34(b) If the value for the nDataSize parameter is not equal to sizeof(void *),
35the HashTable API allocates new memory for the Bucket->pData member using
36the size equivalent to nDataSize and the same value for the persistent flag
37set for the target HashTable. The the contents of the pData parameter is
38copied into the Bucket->pData member in this newly allocated memory location.
39Then the Bucket->pDataPtr member for this Bucket is set to NULL.
40
41Do not worry about the newly allocated memory allocated by the HashTable API;
42if the nDataSize parameter was not equal to sizeof(void *), then
43during the cleanup process, the Zend API will free the new memory it allocated
44during the insert process.
45
46It will also call the destructor function if a valid one was passed when the
47HashTable was initialized with zend_hash_init().
48
49In the extension, I have used the p* version of the memory allocation functions
50to allow me toggle if there is any need to do so in the future. This will prevent
51a massive search and replace effort.
52
53For all the HashTables, I set the intial size to 8 to reduce the looping when
54zend_hash_init() is setting up the HashTable pointer to use.
55

README.SUBMITTING_CONTRIBUTIONS

1================================================================================
2Submitting contributions
3================================================================================
4
5A lot of time has been put into designing, implementing and documenting this extension.
6
7A lot of work has also been put into ensuring that users of the extension
8experience very minimal defects during usage.
9
10New ideas, corrections, bug fixes, feature improvements are always welcome.
11
12However, you must discuss any changes you are about to make to any of
13the source files prior to making or submitting such changes either in the
14PECL developers mailing list (pecl-dev@lists.php.net) or by contacting the
15current author(s) or maintainer(s) of this extension directly.
16
17Test scripts should be included when making the submissions.
18
19Also explain thoroughly what has been fixed/added/changed by your patch.
20
21If your patch is easy to review and has obviously no side-effects,
22it might take up to a few hours until it is committed.
23
24Since this is a volunteer-driven effort, more complex patches will
25require more patience on the part of the submitter.
26
27================================================================================
28Testing thoroughly before submissions
29================================================================================
30
31This is a fairly large library and each component is dependent on another
32component either directly or indirectly.
33
34As a consequence, any and all changes must be tested thoroughly before commiting them.
35
36It is only polite to the users, author(s) or maintainer(s) that you do so.
37
38================================================================================
39Checklist for making submissions
40================================================================================
41
42 - Did you run "make test" to check if your patch didn't break
43   other features?
44 - Did you compile PHP with --enable-debug and check the PHP and
45   web server error logs when you test your patch?
46 - Did you build PHP for multi-threaded web servers.
47 - Did you create test script for "make test"? (Recommended)
48 - Did you check your patch is unified format and it does not
49   contain white space changes?
50 - Did you read the patch again?
51