@@ -16,7 +16,7 @@ Require this package in your composer.json and run composer update:
1616``` json
1717{
1818 "require" : {
19- "nqxcode/laravel-lucene-search" : " 2.1.*-dev "
19+ "nqxcode/laravel-lucene-search" : " 2.1.*"
2020 }
2121}
2222```
@@ -25,15 +25,15 @@ After updating composer, add the ServiceProvider to the providers array in `app/
2525
2626``` php
2727'providers' => [
28- ' Nqxcode\LuceneSearch\ServiceProvider' ,
28+ Nqxcode\LuceneSearch\ServiceProvider::class ,
2929],
3030```
3131
3232If you want to use the facade to search, add this to your facades in ` app/config/app.php ` :
3333
3434``` php
3535'aliases' => [
36- 'Search' => ' Nqxcode\LuceneSearch\Facade' ,
36+ 'Search' => Nqxcode\LuceneSearch\Facade::class ,
3737],
3838```
3939## Configuration
@@ -50,13 +50,13 @@ In published config file add descriptions for models which need to be indexed, f
5050
5151 // ...
5252
53- ' namespace\FirstModel' => [
53+ namespace\FirstModel::class => [
5454 'fields' => [
5555 'name', 'full_description', // Fields for indexing.
5656 ]
5757 ],
5858
59- ' namespace\SecondModel' => [
59+ namespace\SecondModel::class => [
6060 'fields' => [
6161 'name', 'short_description', // Fields for indexing.
6262 ]
@@ -88,7 +88,7 @@ Example:
8888In config file:
8989
9090``` php
91- ' namespace\FirstModel' => [
91+ namespace\FirstModel::class => [
9292 'fields' => [
9393 'name', 'full_description', // Fixed fields for indexing.
9494 ],
@@ -100,7 +100,7 @@ In config file:
100100In model add following accessor:
101101
102102``` php
103- publc function getOptionalAttributesAttribute()
103+ public function getOptionalAttributesAttribute()
104104 {
105105 return [
106106 'optional_attribute1' => "value1",
@@ -119,7 +119,7 @@ This filters can be deleted or replaced with others.
119119'analyzer' => [
120120 'filters' => [
121121 // Default stemming filter.
122- ' Nqxcode\Stemming\TokenFilterEnRu' ,
122+ Nqxcode\Stemming\TokenFilterEnRu::class ,
123123 ],
124124
125125 // List of paths to files with stopwords.
@@ -262,8 +262,9 @@ Highlighting of matches is available for any html fragment encoded in **utf-8**
262262Search::find('nearly all words must be highlighted')->get();
263263$highlighted = Search::highlight('all words');
264264
265- // highlighted html:
266- // '<span class =" highlight" >all</span > <span class =" highlight" >words</span >'
265+ echo $highlighted;
266+
267+ // Echo: <span class =" highlight" >all</span > <span class =" highlight" >words</span >
267268```
268269##
269270## License
0 commit comments