Merge pull request #6370 from kobergj/AddFulltextsearchCapability

Add Fulltextsearch Capability
This commit is contained in:
kobergj
2023-05-25 15:50:43 +02:00
committed by GitHub
10 changed files with 32 additions and 19 deletions

View File

@@ -0,0 +1,5 @@
Enhancement: Add fulltextsearch capabilty
It needs an extra envvar `FRONTEND_FULL_TEXT_SEARCH_ENABLED`
https://github.com/owncloud/ocis/pull/6366

2
go.mod
View File

@@ -13,7 +13,7 @@ require (
github.com/coreos/go-oidc v2.2.1+incompatible
github.com/coreos/go-oidc/v3 v3.6.0
github.com/cs3org/go-cs3apis v0.0.0-20230516150832-730ac860c71d
github.com/cs3org/reva/v2 v2.13.4-0.20230522082327-0d66bdd610d3
github.com/cs3org/reva/v2 v2.13.4-0.20230523132457-4fb99464ab8d
github.com/disintegration/imaging v1.6.2
github.com/dutchcoders/go-clamd v0.0.0-20170520113014-b970184f4d9e
github.com/egirna/icap-client v0.1.1

4
go.sum
View File

@@ -627,8 +627,8 @@ github.com/crewjam/httperr v0.2.0 h1:b2BfXR8U3AlIHwNeFFvZ+BV1LFvKLlzMjzaTnZMybNo
github.com/crewjam/httperr v0.2.0/go.mod h1:Jlz+Sg/XqBQhyMjdDiC+GNNRzZTD7x39Gu3pglZ5oH4=
github.com/crewjam/saml v0.4.13 h1:TYHggH/hwP7eArqiXSJUvtOPNzQDyQ7vwmwEqlFWhMc=
github.com/crewjam/saml v0.4.13/go.mod h1:igEejV+fihTIlHXYP8zOec3V5A8y3lws5bQBFsTm4gA=
github.com/cs3org/reva/v2 v2.13.4-0.20230522082327-0d66bdd610d3 h1:YGqR0xnslU9wkQ8/XhZE0fJ87u5meecdvOQ15VKFiFM=
github.com/cs3org/reva/v2 v2.13.4-0.20230522082327-0d66bdd610d3/go.mod h1:jkngU/36YdFNQfFurjgKl8URY2dkhwgJ5gQXt1GUoPw=
github.com/cs3org/reva/v2 v2.13.4-0.20230523132457-4fb99464ab8d h1:Wuz6lxPY022NP9052zcDFpnqhLkDtik11fYHX1NLF74=
github.com/cs3org/reva/v2 v2.13.4-0.20230523132457-4fb99464ab8d/go.mod h1:jkngU/36YdFNQfFurjgKl8URY2dkhwgJ5gQXt1GUoPw=
github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8 h1:Z9lwXumT5ACSmJ7WGnFl+OMLLjpz5uR2fyz7dC255FI=
github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8/go.mod h1:4abs/jPXcmJzYoYGF91JF9Uq9s/KL5n1jvFDix8KcqY=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=

View File

@@ -48,6 +48,7 @@ type Config struct {
Checksums Checksums `yaml:"checksums"`
ReadOnlyUserAttributes []string `yaml:"read_only_user_attributes" env:"FRONTEND_READONLY_USER_ATTRIBUTES" desc:"Comma separated list of user attributes to indicate as read-only. Supported values: 'user.onPremisesSamAccountName' (username), 'user.displayName', 'user.mail', 'user.passwordProfile' (password), 'user.appRoleAssignments' (role), 'user.accountEnabled' (login allowed), 'drive.quota' (quota)."`
LDAPServerWriteEnabled bool `yaml:"ldap_server_write_enabled" env:"OCIS_LDAP_SERVER_WRITE_ENABLED;FRONTEND_LDAP_SERVER_WRITE_ENABLED" desc:"Allow creating, modifying and deleting LDAP users via the GRAPH API. This can only be set to 'true' when keeping default settings for the LDAP user and group attribute types (the 'OCIS_LDAP_USER_SCHEMA_* and 'OCIS_LDAP_GROUP_SCHEMA_* variables)."`
FullTextSearch bool `yaml:"full_text_search" env:"FRONTEND_FULL_TEXT_SEARCH_ENABLED" descr:"Set to true to signal the web client that full-text search is enabled."`
Middleware Middleware `yaml:"middleware"`

View File

@@ -52,6 +52,7 @@ func FrontendConfigFromStruct(cfg *config.Config) (map[string]interface{}, error
"archivers": archivers,
"app_providers": appProviders,
"favorites": cfg.EnableFavorites,
"full_text_search": cfg.FullTextSearch,
}
if cfg.DefaultUploadProtocol == "tus" {

View File

@@ -8,7 +8,7 @@ The search service is responsible for metadata and content extraction, stores th
## General Considerations
* To use the search service, an event system needs to be configured for all services like NATS, which is shipped and preconfigured.
* The search service consumes events and does not block other tasks.
* The search service consumes events and does not block other tasks.
* When looking for content extraction, [Apache Tika - a content analysis toolkit](https://tika.apache.org) can be used but needs to be installed separately.
Extractions are stored as index via the search service. Consider that indexing requires adequate storage capacity - and the space requirement will grow. To avoid filling up the filesystem with the index and rendering Infinite Scale unusable, the index should reside on its own filesystem.
@@ -57,6 +57,8 @@ When using the Tika container and docker-compose, consider the following:
* See the [ocis_wopi](https://github.com/owncloud/ocis/tree/master/deployments/examples/ocis_wopi) example.
* Containers for the linked service are reachable at a hostname identical to the alias or the service name if no alias was specified.
If using the `tika` extractor, make sure to also set `FRONTEND_FULL_TEXT_SEARCH_ENABLED` in the frontend service to `true`. This will tell the webclient that full-text search has been enabled.
## Search Functionality
The search service consists of two main parts which are file `indexing` and file `search`.
@@ -131,6 +133,6 @@ Note that not names but IDs are necessary and that the specified user ID needs a
The indexing process tries to be self-healing in some situations.
In the following example, let's assume a file tree `foo/bar/baz` exists.
If the folder `bar` gets renamed to `new-bar`, the path to `baz` is no longer `foo/bar/baz` but `foo/new-bar/baz`.
In the following example, let's assume a file tree `foo/bar/baz` exists.
If the folder `bar` gets renamed to `new-bar`, the path to `baz` is no longer `foo/bar/baz` but `foo/new-bar/baz`.
The search service checks the change and either just updates the path in the index or creates a new index for all items affected if none was present.

View File

@@ -48,7 +48,6 @@ The expected failures in this file are from features in the owncloud/ocis repo.
### [Copy or move on an existing resource doesn't create a new version but deletes instead](https://github.com/owncloud/ocis/issues/4797)
- [apiSpacesShares/moveSpaces.feature:322](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/moveSpaces.feature#L322)
- [apiSpacesShares/copySpaces.feature:752](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/copySpaces.feature#L752)
- [apiSpacesShares/copySpaces.feature:793](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/copySpaces.feature#L793)
### [Creating group with empty name returns status code 200](https://github.com/owncloud/ocis/issues/5050)

View File

@@ -616,18 +616,22 @@ func (s *svc) prepareCopy(ctx context.Context, w http.ResponseWriter, r *http.Re
return nil
}
// delete existing tree
delReq := &provider.DeleteRequest{Ref: dstRef}
delRes, err := s.gwClient.Delete(ctx, delReq)
if err != nil {
log.Error().Err(err).Msg("error sending grpc delete request")
w.WriteHeader(http.StatusInternalServerError)
return nil
}
// delete existing tree when overwriting a directory or replacing a file with a directory
if dstStatRes.Info.Type == provider.ResourceType_RESOURCE_TYPE_CONTAINER ||
(dstStatRes.Info.Type == provider.ResourceType_RESOURCE_TYPE_FILE &&
srcStatRes.Info.Type == provider.ResourceType_RESOURCE_TYPE_CONTAINER) {
delReq := &provider.DeleteRequest{Ref: dstRef}
delRes, err := s.gwClient.Delete(ctx, delReq)
if err != nil {
log.Error().Err(err).Msg("error sending grpc delete request")
w.WriteHeader(http.StatusInternalServerError)
return nil
}
if delRes.Status.Code != rpc.Code_CODE_OK && delRes.Status.Code != rpc.Code_CODE_NOT_FOUND {
errors.HandleErrorStatus(log, w, delRes.Status)
return nil
if delRes.Status.Code != rpc.Code_CODE_OK && delRes.Status.Code != rpc.Code_CODE_NOT_FOUND {
errors.HandleErrorStatus(log, w, delRes.Status)
return nil
}
}
} else if p := path.Dir(dstRef.Path); p != "" {
// check if an intermediate path / the parent exists

View File

@@ -148,6 +148,7 @@ type CapabilitiesFiles struct {
Undelete ocsBool `json:"undelete" xml:"undelete"`
Versioning ocsBool `json:"versioning" xml:"versioning"`
Favorites ocsBool `json:"favorites" xml:"favorites"`
FullTextSearch ocsBool `json:"full_text_search" xml:"full_text_search" mapstructure:"full_text_search"`
Tags ocsBool `json:"tags" xml:"tags"`
BlacklistedFiles []string `json:"blacklisted_files" xml:"blacklisted_files>element" mapstructure:"blacklisted_files"`
TusSupport *CapabilitiesFilesTusSupport `json:"tus_support" xml:"tus_support" mapstructure:"tus_support"`

2
vendor/modules.txt vendored
View File

@@ -349,7 +349,7 @@ github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1
github.com/cs3org/go-cs3apis/cs3/storage/registry/v1beta1
github.com/cs3org/go-cs3apis/cs3/tx/v1beta1
github.com/cs3org/go-cs3apis/cs3/types/v1beta1
# github.com/cs3org/reva/v2 v2.13.4-0.20230522082327-0d66bdd610d3
# github.com/cs3org/reva/v2 v2.13.4-0.20230523132457-4fb99464ab8d
## explicit; go 1.19
github.com/cs3org/reva/v2/cmd/revad/internal/grace
github.com/cs3org/reva/v2/cmd/revad/runtime